forked from DGNum/gestioCOF
Websocket as member
This commit is contained in:
parent
413df0806d
commit
8bf1bd5343
1 changed files with 2 additions and 2 deletions
|
@ -51,9 +51,9 @@ class Websocket {
|
||||||
|
|
||||||
listen(handle_func) {
|
listen(handle_func) {
|
||||||
var that = this;
|
var that = this;
|
||||||
var socket = new ReconnectingWebSocket(this.url);
|
this.socket = new ReconnectingWebSocket(this.url);
|
||||||
|
|
||||||
socket.onmessage = function(e) {
|
this.socket.onmessage = function(e) {
|
||||||
var data = $.extend({}, that.default_msg, JSON.parse(e.data));
|
var data = $.extend({}, that.default_msg, JSON.parse(e.data));
|
||||||
handle_func(data);
|
handle_func(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue