From 877541f6ce5ae9a8ba61bb0c9ad76b3fcf30882d Mon Sep 17 00:00:00 2001 From: cha0s Date: Thu, 16 May 2019 15:19:42 -0500 Subject: [PATCH] perf: always hint binary --- packages/net/client/socket.js | 2 +- packages/net/client/worker.js | 2 +- packages/net/server/socket.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/net/client/socket.js b/packages/net/client/socket.js index 27a9b96..d783765 100644 --- a/packages/net/client/socket.js +++ b/packages/net/client/socket.js @@ -69,7 +69,7 @@ export class SocketClient extends decorate(class {}) { send(packet) { const id = idFromPacket(packet.constructor); - this.socket.emit(id, packet.data); + this.socket.binary(true).emit(id, packet.data); } tryReconnect() { diff --git a/packages/net/client/worker.js b/packages/net/client/worker.js index 1124231..5eff588 100644 --- a/packages/net/client/worker.js +++ b/packages/net/client/worker.js @@ -108,7 +108,7 @@ function onMessageEmit(args) { if (!socket) { return; } - socket.emit(...args); + socket.binary(true).emit(...args); } function onMessageOn(type) { diff --git a/packages/net/server/socket.js b/packages/net/server/socket.js index c16d307..f5f8a9f 100644 --- a/packages/net/server/socket.js +++ b/packages/net/server/socket.js @@ -62,7 +62,7 @@ class ServerSocket extends decorateSocket(class {}) { send(packet) { const id = idFromPacket(packet.constructor); - this.socket.emit(id, packet.data); + this.socket.binary(true).emit(id, packet.data); } }