Browse Source

More robust reconnect on server restart.

master
Pete Shadbolt 8 years ago
parent
commit
d6aefcdee8
2 changed files with 6 additions and 1 deletions
  1. +5
    -1
      abp/static/scripts/websocket.js
  2. +1
    -0
      bin/abpserver

+ 5
- 1
abp/static/scripts/websocket.js View File

@@ -1,7 +1,11 @@
var websocket = {}; var websocket = {};
websocket.update = undefined;


websocket.connect = function(update) { websocket.connect = function(update) {
websocket.ws = new WebSocket("ws://localhost:5000"); websocket.ws = new WebSocket("ws://localhost:5000");
if (update){
websocket.update = update;
}
websocket.ws.onopen = function(evt) { websocket.ws.onopen = function(evt) {
gui.serverMessage("Connected to server."); gui.serverMessage("Connected to server.");
}; };
@@ -19,7 +23,7 @@ websocket.connect = function(update) {
json.node[i].vop = 0; json.node[i].vop = 0;
} }
} }
update(json);
websocket.update(json);
}; };


websocket.ws.onclose = function(evt) { websocket.ws.onclose = function(evt) {


+ 1
- 0
bin/abpserver View File

@@ -14,6 +14,7 @@ import argparse
import abp import abp
import json import json
from pkg_resources import resource_filename from pkg_resources import resource_filename
import time


clients = [] clients = []
local_state = abp.GraphState() local_state = abp.GraphState()


Loading…
Cancel
Save