public void OnMessage(string message) { var content = ""; var header = Relay.ParseResponse(message, ref content); if (header == "pong") { ping = (DateTime.Now - pingTime).Milliseconds; } }
public override void OnRawString(string rawString) { var message = Relay.ParseRelayMessage(rawString); if (message.header == "0") { return; } HandleStringMessage(message.senderID, message.header, message.content); }
public override void OnRawString(string message) { string content = ""; var header = Relay.ParseResponse(message, ref content); if (header == "0") { return; } HandleMessage(header, content); }
//Common public void SetMode(DataMode mode) { if (currentDataMode != mode) { currentDataMode = mode; } switch (currentDataMode) { case DataMode.Binary: connection.Send(Relay.StringMessage(Relay.OpCode.binaryMode, 0, "", "")); break; case DataMode.String: connection.SendBytes(Relay.Binary((byte)Relay.OpCode.stringMode, 0, 0, new byte[0])); break; } currentDataMode = mode; dataMode = mode; }
public void Send(uint id, byte messageCode, byte[] bytes) { connection.SendBytes(Relay.Message(id, messageCode, bytes)); }
public void Channelcast(uint id, byte messageCode, byte[] bytes) { connection.SendBytes(Relay.Channelcast(id, messageCode, bytes)); }
public void Broadcast(byte messageCode, byte[] bytes) { connection.SendBytes(Relay.Broadcast(messageCode, bytes)); }
public void Send(uint id, string header, string content) { connection.Send(Relay.Message(id, header, content)); }
public void Send <T>(uint id, T header, string content) where T : struct, IConvertible { connection.Send(Relay.Message(id, header.ToString(), content)); }
public void Send(uint id, string header) { connection.Send(Relay.Message(id, header, "")); }
public void Channelcast(uint id, int header, string content) { connection.Send(Relay.Channelcast(id, header.ToString(), content)); }
//Send String public void Broadcast(string header, string content) { connection.Send(Relay.Broadcast(header, content)); }
public void Join(uint channelID) { connection.Send(Relay.StringMessage(Relay.OpCode.joinChannel, channelID, "", "")); }
public void Send(byte relayCode, uint ID, byte msgCode, byte[] bytes) { connection.SendBytes(Relay.Binary(relayCode, ID, msgCode, bytes)); }