mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
fiusing notificationCenter for sendCommandToAllUsers for testing, seems to work
This commit is contained in:
parent
4ac86c69b4
commit
8cf8f057bb
4 changed files with 20 additions and 8 deletions
|
|
@ -23,11 +23,25 @@ define(["Protocol/Helper"], function(ProtocolHelper) {
|
|||
});
|
||||
}
|
||||
|
||||
User.prototype.setChannel = function(channel){
|
||||
User.prototype.setChannel = function(channel) {
|
||||
if (this.notificationCenter) {
|
||||
this.notificationCenter.off("updateClientsWorld");
|
||||
}
|
||||
|
||||
this.channel = channel;
|
||||
|
||||
// Use the right factory and nc
|
||||
this.notificationCenter = this.channel.notificationCenter;
|
||||
this.factory = this.channel.factory;
|
||||
|
||||
var self = this;
|
||||
this.notificationCenter.on("sendCommandToAllUsers", function(topic, args) {
|
||||
self.sendCommand.apply(self, args);
|
||||
});
|
||||
}
|
||||
|
||||
User.prototype.sendCommand = function(command, options) {
|
||||
|
||||
var message = ProtocolHelper.encodeCommand(command, options);
|
||||
this.socketLink.send(message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue