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