Refactor websocket handler
This commit is contained in:
parent
047027ddec
commit
114bf8201e
8 changed files with 257 additions and 226 deletions
|
@ -59,7 +59,7 @@ class Socket extends EventEmitter {
|
|||
this.send('pong');
|
||||
}
|
||||
|
||||
this.emit(msg.type, msg.response);
|
||||
this.emit(msg.type, msg.data);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ class Socket extends EventEmitter {
|
|||
}
|
||||
|
||||
send(type, data) {
|
||||
this.ws.send(JSON.stringify({ type, request: data }));
|
||||
this.ws.send(JSON.stringify({ type, data }));
|
||||
}
|
||||
|
||||
setTimeoutPing() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue