Переработаны роутеры приложения
Переписано APi WebSocket для работы с новыми роутерами
This commit is contained in:
14
ws/utils/ping.js
Normal file
14
ws/utils/ping.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function setupPing(ws) {
|
||||
const interval = setInterval(() => {
|
||||
if (ws.readyState === 1) {
|
||||
ws.ping("ping");
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 30000);
|
||||
|
||||
ws.on("pong", (data) => {
|
||||
console.log("📡 PONG from client:", data.toString());
|
||||
});
|
||||
}
|
||||
module.exports = { setupPing };
|
||||
Reference in New Issue
Block a user