Exemplo n.º 1
0
        public void OnMessage(string message)
        {
            var content = "";
            var header  = Relay.ParseResponse(message, ref content);

            if (header == "pong")
            {
                ping = (DateTime.Now - pingTime).Milliseconds;
            }
        }
Exemplo n.º 2
0
        public override void OnRawString(string rawString)
        {
            var message = Relay.ParseRelayMessage(rawString);

            if (message.header == "0")
            {
                return;
            }
            HandleStringMessage(message.senderID, message.header, message.content);
        }
Exemplo n.º 3
0
        public override void OnRawString(string message)
        {
            string content = "";
            var    header  = Relay.ParseResponse(message, ref content);

            if (header == "0")
            {
                return;
            }
            HandleMessage(header, content);
        }
Exemplo n.º 4
0
        //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;
        }
Exemplo n.º 5
0
 public void Send(uint id, byte messageCode, byte[] bytes)
 {
     connection.SendBytes(Relay.Message(id, messageCode, bytes));
 }
Exemplo n.º 6
0
 public void Channelcast(uint id, byte messageCode, byte[] bytes)
 {
     connection.SendBytes(Relay.Channelcast(id, messageCode, bytes));
 }
Exemplo n.º 7
0
 public void Broadcast(byte messageCode, byte[] bytes)
 {
     connection.SendBytes(Relay.Broadcast(messageCode, bytes));
 }
Exemplo n.º 8
0
 public void Send(uint id, string header, string content)
 {
     connection.Send(Relay.Message(id, header, content));
 }
Exemplo n.º 9
0
 public void Send <T>(uint id, T header, string content) where T : struct, IConvertible
 {
     connection.Send(Relay.Message(id, header.ToString(), content));
 }
Exemplo n.º 10
0
 public void Send(uint id, string header)
 {
     connection.Send(Relay.Message(id, header, ""));
 }
Exemplo n.º 11
0
 public void Channelcast(uint id, int header, string content)
 {
     connection.Send(Relay.Channelcast(id, header.ToString(), content));
 }
Exemplo n.º 12
0
 //Send String
 public void Broadcast(string header, string content)
 {
     connection.Send(Relay.Broadcast(header, content));
 }
Exemplo n.º 13
0
 public void Join(uint channelID)
 {
     connection.Send(Relay.StringMessage(Relay.OpCode.joinChannel, channelID, "", ""));
 }
Exemplo n.º 14
0
 public void Send(byte relayCode, uint ID, byte msgCode, byte[] bytes)
 {
     connection.SendBytes(Relay.Binary(relayCode, ID, msgCode, bytes));
 }