koa-ws
koa-ws copied to clipboard
Client onMessage bug?
in client.js
, Client.prototype.onMessage
, the argument is e
, so this method would be:
Client.prototype.onMessage = function (e) {
protocol.apply(this, [debug, this.socket, e.data]);
};
Maybe I missed something?
If using the client in the browser then, yes, the argument is the event, e
. But if you use the client directly inside a node module, the argument is just the data. The onMessage
method should be updated to handle either case:
Client.prototype.onMessage = function (e) {
protocol.apply(this, [debug, this.socket, e.data || e]);
};