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 26eceac330
commit f527c225fe
6 changed files with 51 additions and 19 deletions

View File

@@ -62,8 +62,8 @@ export class Client extends EventEmitter implements SocketIO.Client {
}
});
}
packet(packet: Packet, opts?: any) {
this.conn.send(parser.encode(packet))
packet(packet: Packet, opts: any = { preEncoded: false }) {
this.conn.send(opts.preEncoded ? packet as unknown as string : parser.encode(packet))
}
onclose(reason?: string) {
// debug('client close with reason %s', reason);