From 702cfab6bc82fb9fd4ff12ef3368df4229d9a1a9 Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Sat, 30 Jun 2018 19:28:41 +0200 Subject: [PATCH] fix send WebSocket authentication messages --- assets/js/sumorobot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/js/sumorobot.js b/assets/js/sumorobot.js index 3476997..3083729 100755 --- a/assets/js/sumorobot.js +++ b/assets/js/sumorobot.js @@ -60,6 +60,8 @@ Sumorobot.prototype.connect = function() { /* when the WebSocket gets connected */ this.websocket.onopen = function(evt) { console.log("INFO websocket connected"); + // send authentication message + sumorobot.send('{"setID": "browser-' + robotId + '@00000514", "passwd": "salakala"}'); /* setup a timer to ping the robot */ self.watchdogTimer = setInterval(function() { /* send a ping to the robot */ @@ -561,7 +563,6 @@ window.onload = function() { } /* connect to the selected robots WebSocket */ sumorobot = new Sumorobot("ws://" + robotServer); - sumorobot.send('{"setID": "browser-' + robotId + '@00000514", "passwd": "salakala"}'); /* connect to the other block highlight WebSocket */ /*blockHighlight = new WebSocket("ws://" + robotServer + ":80/p2p/browser/" + robotId + "-highlight/"); // when there is a message from the WebSocket