Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Oct 5, 2024
1 parent 279b8c2 commit d9f50b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,26 +173,29 @@ module.exports = class WebSocketServer extends EventEmitter {
if(this.options.allowSynchronousEvents) {
ws.client.emit("message", ws.client.parseMessage(message, isBinary), isBinary);
} else {
const msg = ws.client.parseMessage(message, isBinary);
setImmediate(() => {
ws.client.emit("message", ws.client.parseMessage(message, isBinary), isBinary);
ws.client.emit("message", msg, isBinary);
});
}
},
ping: (ws, message) => {
if(this.options.allowSynchronousEvents) {
ws.client.emit("ping", ws.client.parseMessage(message));
} else {
const msg = ws.client.parseMessage(message);
setImmediate(() => {
ws.client.emit("ping", ws.client.parseMessage(message));
ws.client.emit("ping", msg);
});
}
},
pong: (ws, message) => {
if(this.options.allowSynchronousEvents) {
ws.client.emit("pong", ws.client.parseMessage(message));
} else {
const msg = ws.client.parseMessage(message);
setImmediate(() => {
ws.client.emit("pong", ws.client.parseMessage(message));
ws.client.emit("pong", msg);
});
}
},
Expand Down

0 comments on commit d9f50b6

Please sign in to comment.