Рефакторинг WebSocketConnection, небольшие улучшения

This commit is contained in:
Book Pauk
2021-02-01 17:57:24 +07:00
parent 2427a3e08b
commit a09b70a991
5 changed files with 249 additions and 192 deletions

View File

@@ -50,8 +50,14 @@ class WebSocketController {
log(`WebSocket-IN: ${message.substr(0, 4000)}`);
}
ws.lastActivity = Date.now();
req = JSON.parse(message);
ws.lastActivity = Date.now();
//pong for WebSocketConnection
if (req._rpo === 1)
this.send({_rok: 1}, req, ws);
switch (req.action) {
case 'test':
await this.test(req, ws); break;