webxoss-core/IO_Node.js

19 lines
352 B
JavaScript
Raw Permalink Normal View History

2016-10-23 07:56:45 +02:00
'use strict';
function IO_Socket (socket) {
this.socket = socket;
this.listener = null;
this.socket.on('gameMessage',function (data) {
// TODO:
// check data
if (this.listener) {
this.listener.call(null,data);
}
}.bind(this));
};
IO_Socket.prototype.send = function (data) {
this.socket.emit('gameMessage',data);
};
global.IO = IO;