mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
Change from ws.on('message') to ws.onmessage for browser compat.
This commit is contained in:
@@ -385,15 +385,14 @@ Remote.prototype._connect_start = function () {
|
|||||||
|
|
||||||
self._connect_retry();
|
self._connect_retry();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Node's ws module doesn't pass arguments to onmessage.
|
ws.onmessage = function (json) {
|
||||||
ws.on('message', function (json, flags) {
|
self._connect_message(ws, json.data);
|
||||||
self._connect_message(ws, json, flags);
|
};
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// It is possible for messages to be dispatched after the connection is closed.
|
// It is possible for messages to be dispatched after the connection is closed.
|
||||||
Remote.prototype._connect_message = function (ws, json, flags) {
|
Remote.prototype._connect_message = function (ws, json) {
|
||||||
var message = JSON.parse(json);
|
var message = JSON.parse(json);
|
||||||
var unexpected = false;
|
var unexpected = false;
|
||||||
var request;
|
var request;
|
||||||
|
|||||||
Reference in New Issue
Block a user