From b872e4b6e48df6e5c32dd105070752d87165279f Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 17 Jan 2021 21:08:39 -0600 Subject: [PATCH] fix: binary emission --- packages/socket/src/client/socket.js | 5 ++--- packages/socket/src/socket.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/socket/src/client/socket.js b/packages/socket/src/client/socket.js index c49d007..80128e3 100644 --- a/packages/socket/src/client/socket.js +++ b/packages/socket/src/client/socket.js @@ -47,8 +47,7 @@ export default class SocketClient extends decorate(Class) { this.socket = io(this.address, { ...this.options, }); - const precalc = this.socket.binary(true); - this.socket.emitPromise = promisify(precalc.emit.bind(precalc)); + this.socket.emitPromise = promisify(this.socket.emit.bind(this.socket)); this.socket.on('connect', () => { debug('connect'); this.isConnected = true; @@ -100,7 +99,7 @@ export default class SocketClient extends decorate(Class) { } send(packet) { - return this.constructor.send(this.latus, this.socket, packet, 'emitPromise'); + return this.constructor.send(this.latus, this.socket.binary(true), packet, 'emitPromise'); } to(room) { diff --git a/packages/socket/src/socket.js b/packages/socket/src/socket.js index 3a67b52..f1906a9 100644 --- a/packages/socket/src/socket.js +++ b/packages/socket/src/socket.js @@ -18,8 +18,7 @@ export default class ServerSocket extends decorate(Class) { super(); this.latus = latus; this.socket = socket; - const precalc = this.socket.binary(true); - this.socket.emitPromise = promisify(precalc.emit.bind(precalc)); + this.socket.emitPromise = promisify(this.socket.emit.bind(this.socket)); this.socket.joinPromise = promisify(this.socket.join.bind(this.socket)); this.socket.leavePromise = promisify(this.socket.leave.bind(this.socket)); const Packets = Object.entries(packets(latus).fromType); @@ -73,7 +72,7 @@ export default class ServerSocket extends decorate(Class) { } send(packet) { - return this.constructor.send(this.latus, this.socket, packet, 'emitPromise'); + return this.constructor.send(this.latus, this.socket.binary(true), packet, 'emitPromise'); } to(room) {