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 e6aba870da
commit 805f7ad521
6 changed files with 51 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ import { Socket } from './socket';
import { Adapter } from './adapter';
import { Server } from './index'
import { Packet } from './packet';
import { SubPacketTypes } from './types';
import { PacketTypes, SubPacketTypes } from './types';
export class Namespace extends EventEmitter implements SocketIO.Namespace {
name: string;
@@ -78,7 +78,9 @@ export class Namespace extends EventEmitter implements SocketIO.Namespace {
}
// set up packet object
var packet = {
type: (this.flags.binary !== undefined ? this.flags.binary : this.hasBin(args)) ? SubPacketTypes.BINARY_EVENT : SubPacketTypes.EVENT,
type: PacketTypes.MESSAGE,
sub_type: (this.flags.binary !== undefined ? this.flags.binary : this.hasBin(args)) ? SubPacketTypes.BINARY_EVENT : SubPacketTypes.EVENT,
name: event,
data: args
}