nc refuckulating

This commit is contained in:
logsol 2014-03-17 21:46:19 +01:00
parent 28f71f49e1
commit 4f4bbf73e8
16 changed files with 142 additions and 58 deletions

View file

@ -11,7 +11,7 @@ function (User, Channel, PipeToChannel, Nc, Settings) {
function Coordinator() {
this.channelPipes = {};
Nc.on('coordinator/message', this.onMessage, this);
Nc.on(Nc.ns.server.events.controlCommand + "coordinator", this.onMessage, this);
console.checkpoint('create Coordinator');
}

View file

@ -47,7 +47,7 @@ function (Nc, childProcess) {
}
PipeToChannel.prototype.onMessage = function (message) {
Nc.trigger(message.recipient + '/message', message.data);
Nc.trigger(Nc.ns.server.events.controlCommand + message.recipient, message.data);
}
return PipeToChannel;

View file

@ -16,7 +16,7 @@ function (Parent, ProtocolHelper, Nc) {
socketLink.on('message', this.onMessage.bind(this));
socketLink.on('disconnect', this.onDisconnect.bind(this));
Nc.on("user/" + this.socketLink.id + "/message", this.socketLink.send, this.socketLink);
Nc.on(Nc.ns.server.to.client.message.send + id, this.socketLink.send, this.socketLink);
}
User.prototype = Object.create(Parent.prototype);
@ -73,7 +73,7 @@ function (Parent, ProtocolHelper, Nc) {
User.prototype.onPing = function(timestamp) {
var message = ProtocolHelper.encodeCommand("pong", timestamp);
Nc.trigger("user/" + this.socketLink.id + "/message", message);
Nc.trigger(Nc.ns.server.to.client.message.send + id, message);
};
return User;