fix send WebSocket authentication messages

This commit is contained in:
Silver Kuusik 2018-06-30 19:28:41 +02:00 committed by GitHub
parent 4a3698d4b6
commit 702cfab6bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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