feat: support handshark & boardcast

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-05-14 19:03:41 +08:00
parent fb3803cae9
commit 8731f5d9ef
6 changed files with 51 additions and 19 deletions

View File

@ -72,7 +72,7 @@ export class Adapter extends EventEmitter implements SocketIO.Adapter {
var socket: Socket;
packet.nsp = this.nsp.name;
// let encodedPackets = this.parser.encode(packet)
let encodedPackets = this.parser.encode(packet)
if (rooms.length) {
for (var i = 0; i < rooms.length; i++) {
var room = self.rooms[rooms[i]];
@ -83,7 +83,7 @@ export class Adapter extends EventEmitter implements SocketIO.Adapter {
if (ids[id] || ~except.indexOf(id)) continue;
socket = self.nsp.connected[id];
if (socket) {
socket.packet(packet, packetOpts);
socket.packet(encodedPackets as any, packetOpts);
ids[id] = true;
}
}
@ -94,7 +94,7 @@ export class Adapter extends EventEmitter implements SocketIO.Adapter {
if (self.sids.hasOwnProperty(id)) {
if (~except.indexOf(id)) continue;
socket = self.nsp.connected[id];
if (socket) socket.packet(packet, packetOpts);
if (socket) socket.packet(encodedPackets as any, packetOpts);
}
}
}