fix: binary emission

This commit is contained in:
cha0s 2021-01-17 21:08:39 -06:00
parent 629f410a10
commit b872e4b6e4
2 changed files with 4 additions and 6 deletions

View File

@ -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) {

View File

@ -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) {