iMsg Data_Command(object sender, cMsg Args) { iMsg sReturn = null; WebsocketHandler Connection = (WebsocketHandler)sender; if (Received == null) { return(null); } if (Connection == null) { return(null); } try { sReturn = Received(Connection, Connection.Peer, Args); } catch (Exception ex) { string sLine = "Server.Err: " + ex.Message; Write(sLine); sReturn = new sMsg("error", sLine); } return(sReturn); }
private void Data_Command(object sender, cMsg Args) { iMsg sReturn = null; WebsocketHandler Connection = (WebsocketHandler)sender; if (Command == null) { return; } if (Connection == null) { return; } try { sReturn = Command(Connection, Args); } catch (Exception ex) { sReturn = new sMsg("error", ex.Message); } if (Connection != null) { Connection.Send(sReturn); } }
internal void RaiseConnection() { iMsg sData = Connection(this, new EventArgs()); Connection = null; Send(sData); }
public void Send(iMsg Payload) { if (Payload == null) { return; } switch (Payload.type) { case "logout": { if (SendedQuit) { return; } if (Payload == null) { return; } SendedQuit = true; Send(Payload.Serialize()); return; } case "error": case "reboot": { Send(Payload.Serialize()); return; } } Send(Payload.Serialize()); }
public MsgArgs(iMsg Message) { this.Message = Message; }