void HandleMessage(object sender, WebSocketSharp.MessageEventArgs e) { HFTRelayFromPlayerMessage message = null; try { message = deserializer_.Deserialize <HFTRelayFromPlayerMessage>(e.Data); } catch (System.Exception ex) { log_.Error(ex.ToString()); return; } string cmd = message.cmd; CmdEventHandler handler = null; if (!messageHandlers_.TryGetValue(cmd, out handler)) { log_.Error("unknown player message: " + cmd); return; } handler(deserializer_, message.data); }
public void OnMessage(object sender, WebSocketSharp.MessageEventArgs message) { HFTRelayFromPlayerMessage msg = deserializer_.Deserialize <HFTRelayFromPlayerMessage>(message.Data); CmdEventHandler handler = null; if (!messageHandlers_.TryGetValue(msg.cmd, out handler)) { log_.Error("unknown game message: " + msg.cmd + " for :" + gameId_); return; } handler(deserializer_, msg.id, msg.data); }