Websocket as member

This commit is contained in:
Ludovic Stephan 2017-03-31 15:45:15 -03:00
parent 413df0806d
commit 8bf1bd5343

View file

@ -51,9 +51,9 @@ class Websocket {
listen(handle_func) {
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));
handle_func(data);
}