Using sqlite database, mt proctor animation.
This commit is contained in:
@@ -22,7 +22,9 @@ export { sendCommand, setMainOnMessage, setSecondaryOnMessage,
|
||||
|
||||
class WebSocketConnection {
|
||||
location = '';
|
||||
fullPath = '';
|
||||
reopen = true;
|
||||
onmessageProc = () => 'nothing'
|
||||
ws = null;
|
||||
|
||||
constructor(location) {
|
||||
@@ -35,6 +37,7 @@ class WebSocketConnection {
|
||||
uri = "ws:";
|
||||
}
|
||||
uri += "//" + loc.host;
|
||||
this.fullPath = uri + '/websocket/' + location;
|
||||
this.ws = new WebSocket(uri + '/websocket/' + location);
|
||||
}
|
||||
|
||||
@@ -47,8 +50,17 @@ class WebSocketConnection {
|
||||
this.ws.send(JSON.stringify(cmd));
|
||||
}
|
||||
|
||||
reestablish = () => {
|
||||
this.ws = new WebSocket(this.fullPath);
|
||||
this.ws.onmessage = this.onmessageProc;
|
||||
}
|
||||
|
||||
onmessage(proc) {
|
||||
this.onmessageProc = proc;
|
||||
this.ws.onmessage = proc;
|
||||
// this.ws.onclose = () => {
|
||||
// setTimeout(this.reestablish, 500);
|
||||
// }
|
||||
}
|
||||
|
||||
onopen(proc) {
|
||||
|
||||
Reference in New Issue
Block a user