From 8740f39cc6b7a4854f2aa5a1f52290be2e3ca875 Mon Sep 17 00:00:00 2001 From: Moe Date: Thu, 20 Jan 2022 13:01:15 -0800 Subject: [PATCH] add heartbeat on client side --- web/assets/js/bs5.websocket.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/assets/js/bs5.websocket.js b/web/assets/js/bs5.websocket.js index 86528590..28a0e89c 100644 --- a/web/assets/js/bs5.websocket.js +++ b/web/assets/js/bs5.websocket.js @@ -25,6 +25,9 @@ $(document).ready(function(){ console.log('Sending Data',data) return mainSocket.emit('f',data) } + mainSocket.on('ping', function(){ + mainSocket.emit('pong',{beat:1}) + }) mainSocket.on('connect',function (d){ console.log('Connected to Websocket!') if(location.search === '?p2p=1'){