private void messageReceived(string gateway, UserModel user, string eventChannel, ChannelMessage content) { if (users.ContainsKey(user.UserName)) { var u = users[user.UserName]; u.Socket.Emit("Client.Message", new SocketClientMessageModel(user, eventChannel, content)); } }
private void messageReceived(string name, UserModel user, ChannelMessage message) { user.Gateway = name; if (channels[message.Channel] != null) channels[message.Channel](user, message); }
public void SendMessage(string channel, ChannelMessage message) { var pusher = (QueuePusher) qpCollection.GetByChannel(channel); if (pusher == null) { Global.Console.Log(channel + " No Existy"); return; } pusher.Message(channel, Name, message); }
public SocketClientMessageModel(UserModel user, string channel, ChannelMessage content) { User = user; Channel = channel; Content = content; }
public GatewayMessageModel(string channel, ChannelMessage content) { Channel = channel; Content = content; }
/// <summary> /// the message received from the gameserver /// </summary> /// <param name="gatewayName">This will either be the gateway's name (gateway94) or just "gateway" meaning it was sent to all gateways and you are the one to pop it from the queue</param> /// <param name="channel">the queue channel, generally not needed</param> /// <param name="user"></param> /// <param name="content"></param> private void messageReceived(string gatewayName, UserModel user, ChannelMessage content) { if (users.ContainsKey(user.UserName)) { var u = users[user.UserName]; if (content.Channel == "GameServer.Accept") { //if the gamserver has accepted the player, tell him he has joined var message = ( (GameServerAcceptMessage) content ); u.GameServer = message.GameServer; SocketClientMessageModel socketClientMessageModel = new SocketClientMessageModel(user, "GameServer.Joined", null); u.Socket.Emit("Client.Message", socketClientMessageModel); } else { //otherwise this is a normal message, just forward it along. SocketClientMessageModel socketClientMessageModel = new SocketClientMessageModel(user, content.Channel, content); u.Socket.Emit("Client.Message", socketClientMessageModel); } } else throw new Exception(string.Format("client {0} no found so failure", user.UserName)); }
private void gameServerMessage(string name, UserModel user, ChannelMessage content) { switch (content.Channel) { case PlayerJoinMessage.MessageChannel: var c = (PlayerJoinMessage) content; var lampPlayer = new LampPlayer(user); myGame.MakePlayerActive(lampPlayer); PushPlayerMessage(lampPlayer, new GameServerAcceptMessage() {GameServer = myGameServerInfo.GameServerName}); break; } }
private void gameServerIndexMessage(string name, UserModel user, ChannelMessage content) { LampMessage message = (LampMessage) content; message.User = (LampPlayer) user; myGame.ReceiveMessage(message); }
public void EmitAll(IEnumerable<LampPlayer> players, ChannelMessage val) { foreach (var player in players) { myGameServerInfo.QueueManager.SendMessage(player, player.Gateway, val); } }
public void Emit(LampPlayer player, ChannelMessage val) { myGameServerInfo.QueueManager.SendMessage(player, player.Gateway, val); }
private void PushPlayerMessage(LampPlayer user, ChannelMessage message) { myGameServerInfo.QueueManager.SendMessage(user, user.Gateway, message); }
private void gameServerProductMessage(string name, UserModel user, ChannelMessage content) { var player = (LampPlayer) user; }
public void Message(string channel, string name, ChannelMessage content) { var message = new QueueMessage(name, null, content); var value = Json.Stringify(message, Help.Sanitize); client1.RPush(channel, value); //todo:maybe sanitize }
public QueueMessage(string name, UserModel user, ChannelMessage content) { Name = name; User = user; Content = content; }
public void Emit(ChannelMessage content) { GatewaySocket.Emit("Gateway.Message", new GatewayMessageModel(content.GatewayChannel, content)); }