join success roundtrip added

This commit is contained in:
Logsol 2013-01-03 21:32:24 +01:00
parent e93dbf2f2a
commit 2183e70bd8
5 changed files with 48 additions and 53 deletions

View file

@ -1,9 +1,10 @@
define([
"Game/Core/User",
"Game/Core/Protocol/Helper"
"Game/Core/Protocol/Helper",
"Game/Core/NotificationCenter"
],
function (Parent, ProtocolHelper) {
function (Parent, ProtocolHelper, NotificationCenter) {
function User (socketLink, coordinator) {
Parent.call(this, socketLink.id);
@ -20,6 +21,8 @@ function (Parent, ProtocolHelper) {
socketLink.on('disconnect', function () {
self.onDisconnect();
});
NotificationCenter.on("user/" + this.socketLink.id + "/message", this.onChannelMessage, this);
}
User.prototype = Object.create(Parent.prototype);
@ -62,6 +65,10 @@ function (Parent, ProtocolHelper) {
}
}
User.prototype.onChannelMessage = function(message) {
this.socketLink.send(message);
};
return User;
});