diff --git a/public/samples/relay.js b/public/samples/relay.js index 6b1f4f65f2..300ee8d9ae 100644 --- a/public/samples/relay.js +++ b/public/samples/relay.js @@ -19,9 +19,9 @@ var createMeshConnection = function (connectionId) { obj.websocket.onopen = function (e) { console.log('WebSocket Connected', e); }; obj.websocket.onmessage = function (e) { console.log('WebSocket Message', e); - if ((obj.state = 1) && (e.data == 'c')) { + if ((obj.state == 1) && (e.data == 'c')) { obj.state = 2; - if (obj.onStateChanged) { onStateChanged(obj, 2); } + if (obj.onStateChanged) { obj.onStateChanged(obj, 2); } console.log('WebSocket Peer Connection', e); obj.send('bob'); } else { @@ -31,7 +31,7 @@ var createMeshConnection = function (connectionId) { obj.websocket.onclose = function (e) { console.log('WebSocket Closed', e); obj.state = 0; - if (obj.onStateChanged) { onStateChanged(obj, 0); } + if (obj.onStateChanged) { obj.onStateChanged(obj, 0); } }; obj.websocket.onerror = function (e) { console.log('WebSocket Error', e); }; obj.state = 1; @@ -45,4 +45,4 @@ var createMeshConnection = function (connectionId) { }; return obj; -} \ No newline at end of file +}