diff --git a/lib/index.ts b/lib/index.ts index 403380a3..6f86ac9c 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -122,7 +122,7 @@ export class Adapter extends EventEmitter { for (const id of this.rooms.get(room)) { if (ids.has(id) || except.has(id)) continue; - const socket = this.nsp.connected.get(id); + const socket = this.nsp.sockets.get(id); if (socket) { socket.packet(encodedPackets, packetOpts); ids.add(id); @@ -132,7 +132,7 @@ export class Adapter extends EventEmitter { } else { for (const [id] of this.sids) { if (except.has(id)) continue; - const socket = this.nsp.connected.get(id); + const socket = this.nsp.sockets.get(id); if (socket) socket.packet(encodedPackets, packetOpts); } } @@ -151,14 +151,14 @@ export class Adapter extends EventEmitter { if (!this.rooms.has(room)) continue; for (const id of this.rooms.get(room)) { - if (this.nsp.connected.has(id)) { + if (this.nsp.sockets.has(id)) { sids.add(id); } } } } else { for (const [id] of this.sids) { - if (this.nsp.connected.has(id)) sids.add(id); + if (this.nsp.sockets.has(id)) sids.add(id); } } diff --git a/test/index.js b/test/index.js index 7c792b74..5d4f9e82 100644 --- a/test/index.js +++ b/test/index.js @@ -29,7 +29,7 @@ describe("socket.io-adapter", () => { it("should return a list of sockets", async () => { const adapter = new Adapter({ server: { encoder: null }, - connected: new Map([ + sockets: new Map([ ["s1", true], ["s2", true], ["s3", true]