diff --git a/src/components/WhiteBoard/WhiteBoard.js b/src/components/WhiteBoard/WhiteBoard.js index 9bc7ccc..8cbcfc0 100644 --- a/src/components/WhiteBoard/WhiteBoard.js +++ b/src/components/WhiteBoard/WhiteBoard.js @@ -13,24 +13,23 @@ function WhiteBoard() { var remoteLastY = 0 function received(data) { - console.log("Receiving Message") + // console.log("Receiving Message", data) const jsonData = JSON.parse(data.data); - const message = jsonData.message; - console.log(message) + const received_message = jsonData.message; - if (!message) { + if (!received_message) { // console.error('Invalid data received from the server:', data); return; } - if (message['state'] === "start" || message['state'] === "stop") { + if (received_message['state'] === "start" || received_message['state'] === "stop") { console.log("Info data", data) - remoteLastX = message['x']; - remoteLastY = message['y']; + remoteLastX = received_message['x']; + remoteLastY = received_message['y']; return; } - drawRemoteData(message['x'], message['y']); + drawRemoteData(received_message['x'], received_message['y']); } function drawRemoteData(x, y) { diff --git a/src/components/utils/websocket.js b/src/components/utils/websocket.js index 7f55e71..9108c7f 100644 --- a/src/components/utils/websocket.js +++ b/src/components/utils/websocket.js @@ -1,6 +1,6 @@ function createSocket() { // const socket = new WebSocket('ws://localhost:5000/cable'); - const socket = new WebSocket('wss://analog-be-18680af1ea7c.herokuapp.com/cable'); + const socket = new WebSocket('ws://analog-be-18680af1ea7c.herokuapp.com/cable'); socket.onopen = function(event) { console.log('WebSocket Client Connected'); // var id = Math.random().toString(10)