diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-05-22 12:49:22 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-05-22 12:49:22 +0530 |
commit | f15034e5fe4e5c702975b8a0f583a9917c4b1b3b (patch) | |
tree | ee820cd9d53cd296b916996e3e2d748575168f60 /modern/src/SocketController.js | |
parent | 0ab07c40f48889727b1503eaedb5daa8f344dd19 (diff) | |
download | trackermap-web-f15034e5fe4e5c702975b8a0f583a9917c4b1b3b.tar.gz trackermap-web-f15034e5fe4e5c702975b8a0f583a9917c4b1b3b.tar.bz2 trackermap-web-f15034e5fe4e5c702975b8a0f583a9917c4b1b3b.zip |
Resolving Comments and Observations
Diffstat (limited to 'modern/src/SocketController.js')
-rw-r--r-- | modern/src/SocketController.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js index cda693a1..9ce4ab21 100644 --- a/modern/src/SocketController.js +++ b/modern/src/SocketController.js @@ -27,15 +27,18 @@ const SocketController = () => { const authenticated = useSelector(state => !!state.session.user); const connectSocket = () => { + console.log('connect socket method invoked'); const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; const socket = new WebSocket(protocol + '//' + window.location.host + '/api/socket'); socket.onclose = () => { - setTimeout(() => connectSocket(), 60 * 1000); + console.log('socket closed'); + setTimeout(() => {console.log('socket reconnection try');connectSocket()}, 60 * 1000); }; socket.onmessage = (event) => { const data = JSON.parse(event.data); + console.log('socket message received ', data); if (data.devices) { dispatch(devicesActions.update(data.devices)); } |