aboutsummaryrefslogtreecommitdiff
path: root/modern/src/SocketController.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/SocketController.js')
-rw-r--r--modern/src/SocketController.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js
index cda693a..9ce4ab2 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));
}