diff --git a/packages/socket/package.json b/packages/socket/package.json index 8beccb6..76bb5bb 100644 --- a/packages/socket/package.json +++ b/packages/socket/package.json @@ -36,8 +36,8 @@ "msgpack-lite": "^0.1.26", "proxy-addr": "^2.0.6", "schemapack": "^1.4.2", - "socket.io": "2.3.0", - "socket.io-client": "2.3.0" + "socket.io": "^3.1.0", + "socket.io-client": "^3.1.0" }, "devDependencies": { "@neutrinojs/airbnb-base": "^9.4.0", diff --git a/packages/socket/src/client/index.js b/packages/socket/src/client/index.js index 62ddf5a..51e5479 100644 --- a/packages/socket/src/client/index.js +++ b/packages/socket/src/client/index.js @@ -10,5 +10,11 @@ export default { latus.config['%socket'] = socket; socket.connect(); }, + '@latus/socket/client': ({config: {'@latus/core/client': {id}}}) => ({ + cors: { + origin: false, + }, + path: `/${id}`, + }), }, }; diff --git a/packages/socket/src/client/socket.js b/packages/socket/src/client/socket.js index 7e70c9c..0a6a16f 100644 --- a/packages/socket/src/client/socket.js +++ b/packages/socket/src/client/socket.js @@ -7,7 +7,6 @@ import {Class, compose, EventEmitter} from '@latus/core'; import normalize from '../normalize'; import packets from '../packet/packets'; -import SocketIoParser from '../packet/socket.io-parser'; const debug = D('@latus/socket/client/socket'); @@ -21,19 +20,8 @@ export default class SocketClient extends decorate(Class) { constructor(latus) { super(); - const { - config: { - '@latus/core/client': {id}, - }, - } = latus; this.isConnected = false; this.isReconnecting = false; - this.options = { - parser: SocketIoParser(latus), - path: `/${id}`, - perMessageDeflate: false, - ...latus.invokeReduce('@latus/socket/client'), - }; this.latus = latus; this.socket = null; } @@ -44,9 +32,7 @@ export default class SocketClient extends decorate(Class) { } this.address = address; debug('connecting to %s', this.address); - this.socket = io(this.address, { - ...this.options, - }); + this.socket = io(this.address, this.latus.invokeReduce('@latus/socket/client')); this.socket.emitPromise = promisify(this.socket.emit.bind(this.socket)); this.socket.on('connect', () => { debug('connect'); @@ -54,18 +40,20 @@ export default class SocketClient extends decorate(Class) { this.emit('connect'); }); [ - 'connect', - 'connect_error', - 'connect_timeout', 'error', - 'disconnect', 'reconnect', 'reconnect_attempt', - 'reconnecting', 'reconnect_error', 'reconnect_failed', 'ping', - 'pong', + ].forEach((type) => this.socket.io.on(type, (...args) => { + debug(type, ...args); + this.emit(type, ...args); + })); + [ + 'connect', + 'connect_error', + 'disconnect', ].forEach((type) => this.socket.on(type, (...args) => { debug(type, ...args); this.emit(type, ...args); @@ -73,10 +61,8 @@ export default class SocketClient extends decorate(Class) { const Packets = Object.values(packets(this.latus).fromType); for (let i = 0; i < Packets.length; i++) { const Packet = Packets[i]; - const {id} = Packet; - debug('Registering packet %s(id: %s)', Packet.type, id); - this.socket.on(id, (data, fn) => { - const packet = new Packet(data); + this.socket.on(Packet.id, (data, fn) => { + const packet = new Packet(Packet.decode(data)); debug('recieved packet %s(%j)', Packet.type, packet.data); this.emit('packet', packet, fn); }); @@ -93,13 +79,13 @@ export default class SocketClient extends decorate(Class) { static send(latus, socket, packetOrDehydrated, method) { const packet = normalize(latus, packetOrDehydrated); - debug('sending packet %s(%j)', packet.constructor.type, packet.data); - const {id} = packet.constructor; - return socket[method](id, packet.data); + const {constructor: Packet} = packet; + debug('sending packet %s(%j)', Packet.type, packet.data); + return socket[method](Packet.id, Packet.encode(packet.data)); } send(packet) { - return this.constructor.send(this.latus, this.socket.binary(true), packet, 'emitPromise'); + return this.constructor.send(this.latus, this.socket, packet, 'emitPromise'); } to(room) { diff --git a/packages/socket/src/packet/bundle.js b/packages/socket/src/packet/bundle.js index 01ef302..9507bb0 100644 --- a/packages/socket/src/packet/bundle.js +++ b/packages/socket/src/packet/bundle.js @@ -1,55 +1,46 @@ import normalize from '../normalize'; -import Packet from './packet'; +import PacketClass from './packet'; import packets from './packets'; -export default (latus) => class BundlePacket extends Packet { - - static bundle(packets) { - return this.pack({ - data: [this.id, packets.map((packet) => normalize(latus, packet))], - }); - } +export default (latus) => class BundlePacket extends PacketClass { static get data() { return 'buffer'; } - static packData(packets) { + static pack(packets) { // Pack up all the packets. const packedPackets = new Array(packets.length); for (let i = 0; i < packets.length; i++) { const packet = normalize(latus, packets[i]); - const Packet_ = packet.constructor; - const {id} = Packet_; - packedPackets[i] = Packet_.pack({ - data: [id, packet.data], - }); + const {constructor: Packet} = packet; + packedPackets[i] = [Packet.id, Packet.encode(packet.data)]; } - // Calculate total length. All packed + 4 (int) for each. + // Calculate total length. All packed + 4 (uint) + 2 (ushort) for each. let length = 0; for (let i = 0; i < packedPackets.length; i++) { - length += 4 + packedPackets[i].length; + length += 4 + 2 + packedPackets[i][1].length; } // Allocate buffer. const buffer = Buffer.allocUnsafe(length); let caret = 0; for (let i = 0; i < packedPackets.length; i++) { - const packedPacket = packedPackets[i]; + const [id, packedPacket] = packedPackets[i]; // Write packed length. buffer.writeUInt32LE(packedPacket.length, caret); caret += 4; // Write packed data. + buffer.writeUInt16LE(id, caret); + caret += 2; packedPacket.copy(buffer, caret, 0); caret += packedPacket.length; } return buffer; } - static unbundle(buffer) { - return this.unpack(buffer).data; - } - - static unpackData(buffer) { + static unpack(buffer) { + // eslint-disable-next-line no-param-reassign + buffer = Buffer.from(buffer); const res = []; let caret = 0; while (caret < buffer.length) { @@ -57,17 +48,16 @@ export default (latus) => class BundlePacket extends Packet { const length = buffer.readUInt32LE(caret); caret += 4; // Read packed data. TODO: manual blitting sucks... + const packetId = buffer.readUInt16LE(caret); + caret += 2; const packedPacket = Buffer.allocUnsafe(length); let i = 0; while (i < length) { packedPacket.writeUInt8(buffer.readUInt8(caret++), i++); } // Lookup packet. - const packetId = packedPacket.readUInt8(0); - const {fromId: {[packetId]: Packet_}} = packets(latus); - // Unpack and instantiate the packet. - const unpacked = Packet_.unpack(packedPacket); - res.push(new Packet_(unpacked.data)); + const {fromId: {[packetId]: Packet}} = packets(latus); + res.push(new Packet(Packet.decode(packedPacket))); } return res; } diff --git a/packages/socket/src/packet/packer.js b/packages/socket/src/packet/packer.js index e5f416a..5e4b7a2 100644 --- a/packages/socket/src/packet/packer.js +++ b/packages/socket/src/packet/packer.js @@ -20,14 +20,14 @@ export default (key) => (Superclass) => { }, }, ); - Packer.packData = key + Packer.pack = key ? (data) => { // eslint-disable-next-line no-param-reassign data[key] = msgpack.encode(data[key]); return data; } : (data) => msgpack.encode(data); - Packer.unpackData = key + Packer.unpack = key ? (data) => { // eslint-disable-next-line no-param-reassign data[key] = msgpack.decode(data[key]); diff --git a/packages/socket/src/packet/packet.js b/packages/socket/src/packet/packet.js index 204b57e..81d6e2f 100644 --- a/packages/socket/src/packet/packet.js +++ b/packages/socket/src/packet/packet.js @@ -1,5 +1,4 @@ import schemapack from 'schemapack'; -import {BINARY_EVENT} from './socket.io-parser'; export default class Packet { @@ -9,13 +8,7 @@ export default class Packet { static get builder() { if (!this._builder) { - this._builder = schemapack.build({ - _id: 'uint8', - id: 'uint32', - nsp: 'string', - type: 'uint8', - data: this.data, - }); + this._builder = schemapack.build(this.data); } return this._builder; } @@ -24,17 +17,11 @@ export default class Packet { return {}; } - static pack(packet) { - return this.builder.encode({ - id: packet.id || 0, - nsp: packet.nsp || '/', - type: packet.type || BINARY_EVENT, - _id: packet.data[0], - data: this.packData(packet.data[1]), - }); + static encode(data) { + return this.builder.encode(this.pack(data)); } - static packData(data) { + static pack(data) { return data; } @@ -42,13 +29,11 @@ export default class Packet { return packet.respond ? packet.respond(socket) : undefined; } - static unpack(buffer) { - const unpacked = this.builder.decode(buffer); - unpacked.data = this.unpackData(unpacked.data); - return unpacked; + static decode(buffer) { + return this.unpack(this.builder.decode(buffer)); } - static unpackData(data) { + static unpack(data) { return data; } diff --git a/packages/socket/src/packet/socket.io-parser.js b/packages/socket/src/packet/socket.io-parser.js deleted file mode 100644 index 69dcc80..0000000 --- a/packages/socket/src/packet/socket.io-parser.js +++ /dev/null @@ -1,116 +0,0 @@ -/* eslint-disable max-classes-per-file */ -import { - compose, - deflate, - EventEmitter, - inflate, -} from '@latus/core'; - -import packets from './packets'; - -export const types = [ - 'CONNECT', - 'DISCONNECT', - 'EVENT', - 'ACK', - 'ERROR', - 'BINARY_EVENT', - 'BINARY_ACK', -]; - -export const CONNECT = 0; -export const DISCONNECT = 1; -export const EVENT = 2; -export const ACK = 3; -export const ERROR = 4; -export const BINARY_EVENT = 5; -export const BINARY_ACK = 6; - -const Encoder = (latus) => class Encoder { - - encode(packet, callback) { - switch (packet.type) { - case BINARY_ACK: - case BINARY_EVENT: - return callback([this.pack(packet)]); - default: - return callback([JSON.stringify(packet)]); - } - } - - // eslint-disable-next-line class-methods-use-this - pack(packet) { - const packetId = packet.data[0]; - const Packet = packets(latus).fromId[packetId]; - try { - return deflate(Packet.pack(packet)); - } - catch (error) { - const next = new Error(`Couldn't pack ${ - Packet.type - }(${ - JSON.stringify(packet.data[1], null, 2) - }): ${ - error.message - }: ${ - error.stack - }`); - // eslint-disable-next-line no-console - console.error(next); - throw next; - } - } - -}; - -const decorate = compose( - EventEmitter, -); - -const Decoder = (latus) => class Decoder extends decorate(class {}) { - - add(obj) { - if (typeof obj === 'string') { - this.parseJSON(obj); - } - else { - this.parseBinary(obj); - } - } - - // eslint-disable-next-line class-methods-use-this - destroy() {} - - parseBinary(binary) { - const packet = inflate(Buffer.from(binary)); - const view = new Uint8Array(packet); - const packetId = view[0]; - const Packet = packets(latus).fromId[packetId]; - try { - const unpacked = Packet.unpack(packet); - const {data} = unpacked; - this.emit('decoded', { - type: unpacked.type, - data: [packetId, data], - id: unpacked.id, - nsp: unpacked.nsp, - }); - } - catch (error) { - const next = new Error(`Couldn't unpack ${Packet.type}(${view}): ${error.stack}`); - // eslint-disable-next-line no-console - console.error(next); - throw next; - } - } - - parseJSON(obj) { - this.emit('decoded', JSON.parse(obj)); - } - -}; - -export default (latus) => ({ - Decoder: Decoder(latus), - Encoder: Encoder(latus), -}); diff --git a/packages/socket/src/server.js b/packages/socket/src/server.js index 5846770..1e5f973 100644 --- a/packages/socket/src/server.js +++ b/packages/socket/src/server.js @@ -14,5 +14,8 @@ export default { '@latus/socket/connect': (socket) => { socket.on('packet', acceptor(socket)); }, + '@latus/socket/server': ({config: {'@latus/core': {id}}}) => ({ + path: `/${id}`, + }), }, }; diff --git a/packages/socket/src/socket-server.js b/packages/socket/src/socket-server.js index ca832f4..f6b1169 100644 --- a/packages/socket/src/socket-server.js +++ b/packages/socket/src/socket-server.js @@ -4,31 +4,19 @@ import SocketIoServer from 'socket.io'; import normalize from './normalize'; import ServerSocket from './socket'; -import SocketIoParser from './packet/socket.io-parser'; const debug = D('@latus/socket/server/sockets'); export default class SocketServer { constructor(httpServer, latus) { - // eslint-disable-next-line no-param-reassign - latus.config['%sockets'] = this; + latus.set('%sockets', this); this.onConnect = this.onConnect.bind(this); this.latus = latus; - const { - config: { - '@latus/core': {id}, - }, - } = latus; this.io = SocketIoServer(httpServer, { - parser: SocketIoParser(latus), - path: `/${id}`, - perMessageDeflate: false, - serveClient: false, ...latus.invokeReduce('@latus/socket/server'), + serveClient: false, }); - latus.invoke('@latus/socket/server.io', this.io); - this.io.on('connect', this.onConnect); const {app} = httpServer; this.io.use((socket, next) => { Object.defineProperty(socket.handshake, 'ip', { @@ -41,6 +29,8 @@ export default class SocketServer { }); latus.invokeMiddleware('@latus/socket/authenticate', socket, next); }); + latus.invoke('@latus/socket/server.io', this.io); + this.io.on('connect', this.onConnect); } close(fn) { @@ -64,7 +54,7 @@ export default class SocketServer { const packet = normalize(latus, packetOrDehydrated); debug('sending packet %s(%j)', packet.constructor.type, packet.data); const {id} = packet.constructor; - nsp.binary(true).emit(id, packet.data); + nsp.emit(id, packet.data); } send(packet) { diff --git a/packages/socket/src/socket.js b/packages/socket/src/socket.js index ff85554..ae89fc3 100644 --- a/packages/socket/src/socket.js +++ b/packages/socket/src/socket.js @@ -19,10 +19,7 @@ export default class ServerSocket extends decorate(Class) { this.latus = latus; this.socket = socket; this.socket.emitPromise = promisify(this.socket.emit.bind(this.socket)); - this.socket.joinPromise = promisify(this.socket.join.bind(this.socket)); - this.socket.leavePromise = promisify(this.socket.leave.bind(this.socket)); [ - 'error', 'disconnect', 'disconnecting', ].forEach((type) => this.socket.on(type, (...args) => { @@ -32,9 +29,8 @@ export default class ServerSocket extends decorate(Class) { const Packets = Object.entries(packets(latus).fromType); for (let i = 0; i < Packets.length; i++) { const [type, Packet] = Packets[i]; - const {id} = Packet; - this.socket.on(id, (data, fn) => { - const packet = new Packet(data); + this.socket.on(Packet.id, (data, fn) => { + const packet = new Packet(Packet.decode(data)); debug('recieved packet %s(%j)', type, data); this.emit('packet', packet, fn); }); @@ -50,11 +46,11 @@ export default class ServerSocket extends decorate(Class) { } leave(channel) { - return this.socket.leavePromise(channel); + return this.socket.leave(channel); } join(channel) { - return this.socket.joinPromise(channel); + return this.socket.join(channel); } get req() { @@ -62,18 +58,18 @@ export default class ServerSocket extends decorate(Class) { } get rooms() { - return this.socket.rooms; + return Array.from(this.socket.rooms.keys()); } static send(latus, socket, packetOrDehydrated, method) { const packet = normalize(latus, packetOrDehydrated); - debug('sending packet %s(%j)', packet.constructor.type, packet.data); - const {id} = packet.constructor; - return socket[method](id, packet.data); + const {constructor: Packet} = packet; + debug('sending packet %s(%j)', Packet.type, packet.data); + return socket[method](Packet.id, Packet.encode(packet.data)); } send(packet) { - return this.constructor.send(this.latus, this.socket.binary(true), packet, 'emitPromise'); + return this.constructor.send(this.latus, this.socket, packet, 'emitPromise'); } to(room) { diff --git a/packages/socket/yarn.lock b/packages/socket/yarn.lock index 5417194..dfedb9e 100644 --- a/packages/socket/yarn.lock +++ b/packages/socket/yarn.lock @@ -1090,6 +1090,21 @@ resolved "http://npm.cha0sdev/@types%2fanymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== +"@types/component-emitter@^1.2.10": + version "1.2.10" + resolved "http://npm.cha0sdev/@types%2fcomponent-emitter/-/component-emitter-1.2.10.tgz#ef5b1589b9f16544642e473db5ea5639107ef3ea" + integrity sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg== + +"@types/cookie@^0.4.0": + version "0.4.0" + resolved "http://npm.cha0sdev/@types%2fcookie/-/cookie-0.4.0.tgz#14f854c0f93d326e39da6e3b6f34f7d37513d108" + integrity sha512-y7mImlc/rNkvCRmg8gC3/lj87S7pTUIJ6QGjwHR9WQJcFs+ZMTOaoPrkdFA/YdbuqVEmEbb5RdhVxMkAcgOnpg== + +"@types/cors@^2.8.8": + version "2.8.9" + resolved "http://npm.cha0sdev/@types%2fcors/-/cors-2.8.9.tgz#4bd1fcac72eca8d5bec93e76c7fdcbdc1bc2cd4a" + integrity sha512-zurD1ibz21BRlAOIKP8yhrxlqKx6L9VCwkB5kMiP6nZAhoF5MvC7qS1qPA7nRcr1GJolfkQC7/EAL4hdYejLtg== + "@types/glob@^7.1.1": version "7.1.3" resolved "http://npm.cha0sdev/@types%2fglob/-/glob-7.1.3.tgz#e6ba80f36b7daad2c685acd9266382e68985c183" @@ -1118,7 +1133,7 @@ resolved "http://npm.cha0sdev/@types%2fminimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*": +"@types/node@*", "@types/node@^14.14.10": version "14.14.21" resolved "http://npm.cha0sdev/@types%2fnode/-/node-14.14.21.tgz#d934aacc22424fe9622ebf6857370c052eae464e" integrity sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A== @@ -1354,11 +1369,6 @@ acorn@^7.4.0: resolved "http://npm.cha0sdev/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -after@0.8.2: - version "0.8.2" - resolved "http://npm.cha0sdev/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" - integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8= - ajv-errors@^1.0.0: version "1.0.1" resolved "http://npm.cha0sdev/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" @@ -1566,11 +1576,6 @@ array.prototype.flatmap@^1.2.3: es-abstract "^1.18.0-next.1" function-bind "^1.1.1" -arraybuffer.slice@~0.0.7: - version "0.0.7" - resolved "http://npm.cha0sdev/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz#3bbc4275dd584cc1b10809b89d4e8b63a69e7675" - integrity sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog== - asn1.js@^5.2.0: version "5.4.1" resolved "http://npm.cha0sdev/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" @@ -1705,7 +1710,7 @@ babel-plugin-transform-react-remove-prop-types@^0.4.24: resolved "http://npm.cha0sdev/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz#f2edaf9b4c6a5fbe5c1d678bfb531078c1555f3a" integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA== -backo2@1.0.2: +backo2@~1.0.2: version "1.0.2" resolved "http://npm.cha0sdev/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" integrity sha1-MasayLEpNjRj41s+u2n038+6eUc= @@ -1720,17 +1725,12 @@ base64-arraybuffer@0.1.4: resolved "http://npm.cha0sdev/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz#9818c79e059b1355f97e0428a017c838e90ba812" integrity sha1-mBjHngWbE1X5fgQooBfIOOkLqBI= -base64-arraybuffer@0.1.5: - version "0.1.5" - resolved "http://npm.cha0sdev/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz#73926771923b5a19747ad666aa5cd4bf9c6e9ce8" - integrity sha1-c5JncZI7Whl0etZmqlzUv5xunOg= - base64-js@^1.0.2, base64-js@^1.3.1: version "1.5.1" resolved "http://npm.cha0sdev/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -base64id@2.0.0: +base64id@2.0.0, base64id@~2.0.0: version "2.0.0" resolved "http://npm.cha0sdev/base64id/-/base64id-2.0.0.tgz#2770ac6bc47d312af97a8bf9a634342e0cd25cb6" integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog== @@ -1760,13 +1760,6 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -better-assert@~1.0.0: - version "1.0.2" - resolved "http://npm.cha0sdev/better-assert/-/better-assert-1.0.2.tgz#40866b9e1b9e0b55b481894311e68faffaebc522" - integrity sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI= - dependencies: - callsite "1.0.0" - big.js@^5.2.2: version "5.2.2" resolved "http://npm.cha0sdev/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" @@ -1789,11 +1782,6 @@ bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" -blob@0.0.5: - version "0.0.5" - resolved "http://npm.cha0sdev/blob/-/blob-0.0.5.tgz#d680eeef25f8cd91ad533f5b01eed48e64caf683" - integrity sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig== - bluebird@^3.5.5: version "3.7.2" resolved "http://npm.cha0sdev/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" @@ -2060,11 +2048,6 @@ caller-path@^2.0.0: dependencies: caller-callsite "^2.0.0" -callsite@1.0.0: - version "1.0.0" - resolved "http://npm.cha0sdev/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20" - integrity sha1-KAOY5dZkvXQDi28JBRU+borxvCA= - callsites@^2.0.0: version "2.0.0" resolved "http://npm.cha0sdev/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" @@ -2351,26 +2334,11 @@ commondir@^1.0.1: resolved "http://npm.cha0sdev/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= -component-bind@1.0.0: - version "1.0.0" - resolved "http://npm.cha0sdev/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1" - integrity sha1-AMYIq33Nk4l8AAllGx06jh5zu9E= - -component-emitter@1.2.1: - version "1.2.1" - resolved "http://npm.cha0sdev/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" - integrity sha1-E3kY1teCg/ffemt8WmPhQOaUJeY= - component-emitter@^1.2.1, component-emitter@~1.3.0: version "1.3.0" resolved "http://npm.cha0sdev/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== -component-inherit@0.0.3: - version "0.0.3" - resolved "http://npm.cha0sdev/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143" - integrity sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM= - compressible@~2.0.16: version "2.0.18" resolved "http://npm.cha0sdev/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" @@ -2460,16 +2428,16 @@ cookie-signature@1.0.6: resolved "http://npm.cha0sdev/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= -cookie@0.3.1: - version "0.3.1" - resolved "http://npm.cha0sdev/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" - integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s= - cookie@0.4.0: version "0.4.0" resolved "http://npm.cha0sdev/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== +cookie@~0.4.1: + version "0.4.1" + resolved "http://npm.cha0sdev/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" + integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== + copy-concurrently@^1.0.0: version "1.0.5" resolved "http://npm.cha0sdev/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" @@ -2518,6 +2486,14 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "http://npm.cha0sdev/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +cors@~2.8.5: + version "2.8.5" + resolved "http://npm.cha0sdev/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" + integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== + dependencies: + object-assign "^4" + vary "^1" + cosmiconfig@^5.0.0: version "5.2.1" resolved "http://npm.cha0sdev/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" @@ -2668,7 +2644,7 @@ debug@4.2.0: dependencies: ms "2.1.2" -debug@4.3.1, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: +debug@4.3.1, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@~4.3.1: version "4.3.1" resolved "http://npm.cha0sdev/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== @@ -2682,20 +2658,6 @@ debug@^3.1.1, debug@^3.2.6: dependencies: ms "^2.1.1" -debug@~3.1.0: - version "3.1.0" - resolved "http://npm.cha0sdev/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== - dependencies: - ms "2.0.0" - -debug@~4.1.0: - version "4.1.1" - resolved "http://npm.cha0sdev/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== - dependencies: - ms "^2.1.1" - decamelize@^1.1.2, decamelize@^1.2.0: version "1.2.0" resolved "http://npm.cha0sdev/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -3022,45 +2984,41 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -engine.io-client@~3.4.0: - version "3.4.4" - resolved "http://npm.cha0sdev/engine.io-client/-/engine.io-client-3.4.4.tgz#77d8003f502b0782dd792b073a4d2cf7ca5ab967" - integrity sha512-iU4CRr38Fecj8HoZEnFtm2EiKGbYZcPn3cHxqNGl/tmdWRf60KhK+9vE0JeSjgnlS/0oynEfLgKbT9ALpim0sQ== +engine.io-client@~4.1.0: + version "4.1.0" + resolved "http://npm.cha0sdev/engine.io-client/-/engine.io-client-4.1.0.tgz#dce19be6ee1ec4440c592b45f6f5cef28acb4b3f" + integrity sha512-OUmn4m71/lW3ixICv4h3DuBRuh3ri0w3cDuepjsrINSbbqbni4Xw1shTFiKhl0v58lEtNpwJTpSKJJ3fondu5Q== dependencies: + base64-arraybuffer "0.1.4" component-emitter "~1.3.0" - component-inherit "0.0.3" - debug "~3.1.0" - engine.io-parser "~2.2.0" + debug "~4.3.1" + engine.io-parser "~4.0.1" has-cors "1.1.0" - indexof "0.0.1" parseqs "0.0.6" parseuri "0.0.6" - ws "~6.1.0" + ws "~7.4.2" xmlhttprequest-ssl "~1.5.4" yeast "0.1.2" -engine.io-parser@~2.2.0: - version "2.2.1" - resolved "http://npm.cha0sdev/engine.io-parser/-/engine.io-parser-2.2.1.tgz#57ce5611d9370ee94f99641b589f94c97e4f5da7" - integrity sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg== +engine.io-parser@~4.0.0, engine.io-parser@~4.0.1: + version "4.0.2" + resolved "http://npm.cha0sdev/engine.io-parser/-/engine.io-parser-4.0.2.tgz#e41d0b3fb66f7bf4a3671d2038a154024edb501e" + integrity sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg== dependencies: - after "0.8.2" - arraybuffer.slice "~0.0.7" base64-arraybuffer "0.1.4" - blob "0.0.5" - has-binary2 "~1.0.2" -engine.io@~3.4.0: - version "3.4.2" - resolved "http://npm.cha0sdev/engine.io/-/engine.io-3.4.2.tgz#8fc84ee00388e3e228645e0a7d3dfaeed5bd122c" - integrity sha512-b4Q85dFkGw+TqgytGPrGgACRUhsdKc9S9ErRAXpPGy/CXKs4tYoHDkvIRdsseAF7NjfVwjRFIn6KTnbw7LwJZg== +engine.io@~4.1.0: + version "4.1.0" + resolved "http://npm.cha0sdev/engine.io/-/engine.io-4.1.0.tgz#d8ac90a09ed9fc703abf87023f1e1815e33f044e" + integrity sha512-vW7EAtn0HDQ4MtT5QbmCHF17TaYLONv2/JwdYsq9USPRZVM4zG7WB3k0Nc321z8EuSOlhGokrYlYx4176QhD0A== dependencies: accepts "~1.3.4" base64id "2.0.0" - cookie "0.3.1" - debug "~4.1.0" - engine.io-parser "~2.2.0" - ws "^7.1.2" + cookie "~0.4.1" + cors "~2.8.5" + debug "~4.3.1" + engine.io-parser "~4.0.0" + ws "~7.4.2" enhanced-resolve@^0.9.1: version "0.9.1" @@ -4076,13 +4034,6 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" -has-binary2@~1.0.2: - version "1.0.3" - resolved "http://npm.cha0sdev/has-binary2/-/has-binary2-1.0.3.tgz#7776ac627f3ea77250cfc332dab7ddf5e4f5d11d" - integrity sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw== - dependencies: - isarray "2.0.1" - has-cors@1.1.0: version "1.1.0" resolved "http://npm.cha0sdev/has-cors/-/has-cors-1.1.0.tgz#5e474793f7ea9843d1bb99c23eef49ff126fff39" @@ -4446,11 +4397,6 @@ indexes-of@^1.0.1: resolved "http://npm.cha0sdev/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" integrity sha1-8w9xbI4r00bHtn0985FVZqfAVgc= -indexof@0.0.1: - version "0.0.1" - resolved "http://npm.cha0sdev/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" - integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= - infer-owner@^1.0.3: version "1.0.4" resolved "http://npm.cha0sdev/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" @@ -4785,11 +4731,6 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: resolved "http://npm.cha0sdev/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= -isarray@2.0.1: - version "2.0.1" - resolved "http://npm.cha0sdev/isarray/-/isarray-2.0.1.tgz#a37d94ed9cda2d59865c9f76fe596ee1f338741e" - integrity sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4= - isexe@^2.0.0: version "2.0.0" resolved "http://npm.cha0sdev/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -5713,16 +5654,11 @@ oauth-sign@~0.9.0: resolved "http://npm.cha0sdev/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "http://npm.cha0sdev/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= -object-component@0.0.3: - version "0.0.3" - resolved "http://npm.cha0sdev/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291" - integrity sha1-8MaapQ78lbhmwYb0AKM3acsvEpE= - object-copy@^0.1.0: version "0.1.0" resolved "http://npm.cha0sdev/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" @@ -6028,25 +5964,11 @@ parse-passwd@^1.0.0: resolved "http://npm.cha0sdev/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= -parseqs@0.0.5: - version "0.0.5" - resolved "http://npm.cha0sdev/parseqs/-/parseqs-0.0.5.tgz#d5208a3738e46766e291ba2ea173684921a8b89d" - integrity sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0= - dependencies: - better-assert "~1.0.0" - parseqs@0.0.6: version "0.0.6" resolved "http://npm.cha0sdev/parseqs/-/parseqs-0.0.6.tgz#8e4bb5a19d1cdc844a08ac974d34e273afa670d5" integrity sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w== -parseuri@0.0.5: - version "0.0.5" - resolved "http://npm.cha0sdev/parseuri/-/parseuri-0.0.5.tgz#80204a50d4dbb779bfdc6ebe2778d90e4bce320a" - integrity sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo= - dependencies: - better-assert "~1.0.0" - parseuri@0.0.6: version "0.0.6" resolved "http://npm.cha0sdev/parseuri/-/parseuri-0.0.6.tgz#e1496e829e3ac2ff47f39a4dd044b32823c4a25a" @@ -7172,60 +7094,47 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -socket.io-adapter@~1.1.0: - version "1.1.2" - resolved "http://npm.cha0sdev/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz#ab3f0d6f66b8fc7fca3959ab5991f82221789be9" - integrity sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g== +socket.io-adapter@~2.1.0: + version "2.1.0" + resolved "http://npm.cha0sdev/socket.io-adapter/-/socket.io-adapter-2.1.0.tgz#edc5dc36602f2985918d631c1399215e97a1b527" + integrity sha512-+vDov/aTsLjViYTwS9fPy5pEtTkrbEKsw2M+oVSoFGw6OD1IpvlV1VPhUzNbofCQ8oyMbdYJqDtGdmHQK6TdPg== -socket.io-client@2.3.0: - version "2.3.0" - resolved "http://npm.cha0sdev/socket.io-client/-/socket.io-client-2.3.0.tgz#14d5ba2e00b9bcd145ae443ab96b3f86cbcc1bb4" - integrity sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA== - dependencies: - backo2 "1.0.2" - base64-arraybuffer "0.1.5" - component-bind "1.0.0" - component-emitter "1.2.1" - debug "~4.1.0" - engine.io-client "~3.4.0" - has-binary2 "~1.0.2" - has-cors "1.1.0" - indexof "0.0.1" - object-component "0.0.3" - parseqs "0.0.5" - parseuri "0.0.5" - socket.io-parser "~3.3.0" - to-array "0.1.4" - -socket.io-parser@~3.3.0: - version "3.3.2" - resolved "http://npm.cha0sdev/socket.io-parser/-/socket.io-parser-3.3.2.tgz#ef872009d0adcf704f2fbe830191a14752ad50b6" - integrity sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg== +socket.io-client@^3.1.0: + version "3.1.0" + resolved "http://npm.cha0sdev/socket.io-client/-/socket.io-client-3.1.0.tgz#da3902c80a02a16cf57769c5e3f9d4cb278b6e56" + integrity sha512-T4qPOL80KnoBwkdR70zMpiR6aH6zv3ZqLNriofHqsO9wvQllNTOez0mpV4GdVqo1Y55Z+h8YOlBo7c8pOxDlHw== dependencies: + "@types/component-emitter" "^1.2.10" + backo2 "~1.0.2" component-emitter "~1.3.0" - debug "~3.1.0" - isarray "2.0.1" + debug "~4.3.1" + engine.io-client "~4.1.0" + parseuri "0.0.6" + socket.io-parser "~4.0.4" -socket.io-parser@~3.4.0: - version "3.4.1" - resolved "http://npm.cha0sdev/socket.io-parser/-/socket.io-parser-3.4.1.tgz#b06af838302975837eab2dc980037da24054d64a" - integrity sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A== +socket.io-parser@~4.0.3, socket.io-parser@~4.0.4: + version "4.0.4" + resolved "http://npm.cha0sdev/socket.io-parser/-/socket.io-parser-4.0.4.tgz#9ea21b0d61508d18196ef04a2c6b9ab630f4c2b0" + integrity sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g== dependencies: - component-emitter "1.2.1" - debug "~4.1.0" - isarray "2.0.1" + "@types/component-emitter" "^1.2.10" + component-emitter "~1.3.0" + debug "~4.3.1" -socket.io@2.3.0: - version "2.3.0" - resolved "http://npm.cha0sdev/socket.io/-/socket.io-2.3.0.tgz#cd762ed6a4faeca59bc1f3e243c0969311eb73fb" - integrity sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg== +socket.io@^3.1.0: + version "3.1.0" + resolved "http://npm.cha0sdev/socket.io/-/socket.io-3.1.0.tgz#4f3accda31e95893f618090c9cb5e85d345421fb" + integrity sha512-Aqg2dlRh6xSJvRYK31ksG65q4kmBOqU4g+1ukhPcoT6wNGYoIwSYPlCPuRwOO9pgLUajojGFztl6+V2opmKcww== dependencies: - debug "~4.1.0" - engine.io "~3.4.0" - has-binary2 "~1.0.2" - socket.io-adapter "~1.1.0" - socket.io-client "2.3.0" - socket.io-parser "~3.4.0" + "@types/cookie" "^0.4.0" + "@types/cors" "^2.8.8" + "@types/node" "^14.14.10" + accepts "~1.3.4" + base64id "~2.0.0" + debug "~4.3.1" + engine.io "~4.1.0" + socket.io-adapter "~2.1.0" + socket.io-parser "~4.0.3" sockjs-client@^1.5.0: version "1.5.0" @@ -7713,11 +7622,6 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" -to-array@0.1.4: - version "0.1.4" - resolved "http://npm.cha0sdev/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890" - integrity sha1-F+bBH3PdTz10zaek/zI46a2b+JA= - to-arraybuffer@^1.0.0: version "1.0.1" resolved "http://npm.cha0sdev/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" @@ -8037,7 +7941,7 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -vary@~1.1.2: +vary@^1, vary@~1.1.2: version "1.1.2" resolved "http://npm.cha0sdev/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= @@ -8311,18 +8215,11 @@ ws@^6.2.1: dependencies: async-limiter "~1.0.0" -ws@^7.1.2: +ws@~7.4.2: version "7.4.2" resolved "http://npm.cha0sdev/ws/-/ws-7.4.2.tgz#782100048e54eb36fe9843363ab1c68672b261dd" integrity sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA== -ws@~6.1.0: - version "6.1.4" - resolved "http://npm.cha0sdev/ws/-/ws-6.1.4.tgz#5b5c8800afab925e94ccb29d153c8d02c1776ef9" - integrity sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA== - dependencies: - async-limiter "~1.0.0" - xmlhttprequest-ssl@~1.5.4: version "1.5.5" resolved "http://npm.cha0sdev/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e" diff --git a/packages/user/src/server.js b/packages/user/src/server.js index 3d7577a..328c55e 100644 --- a/packages/user/src/server.js +++ b/packages/user/src/server.js @@ -48,11 +48,16 @@ export default { ], '@latus/redis/intercom': () => ({ '@latus/user/users': (sids, io) => { - const {connected} = io.of('/'); - const here = sids.filter((sid) => !!connected[sid]); - // eslint-disable-next-line max-len - const reduced = here.reduce((r, sid) => ({...r, [sid]: connected[sid].handshake.user.id}), {}); - return reduced; + const {sockets} = io.of('/'); + return sids + .filter((sid) => sockets.has(sid)) + .reduce( + (r, sid) => ({ + ...r, + [sid]: sockets.get(sid).handshake.user.id, + }), + {}, + ); }, }), '@latus/socket/authenticate': (latus) => (socket, next) => {