예제 #1
0
        public SocketIOPacket(string input)
        {
            _type = (SocketIOPacketType)int.Parse(new string(input[0], 1));
            var str = input.Substring(1);

            if (str.StartsWith("/"))
            {
                // is NameSapce
                _nsp = str.Split(',')[0];
                str  = str.Split(',')[1];
            }
            if (str[0] != '[' && str[0] != '{')
            {
                var strId = "";
                for (var i = 0; i < str.Length; i++)
                {
                    if (char.IsNumber(str[i]))
                    {
                        strId += str[i];
                    }
                    else
                    {
                        _id = int.Parse(strId);
                        str = str.Substring(i);
                        break;
                    }
                }
            }
            _data = str;
        }
예제 #2
0
 public SocketIOPacket(SocketIOPacketType type, string data)
 {
     _type = type;
     _data = data;
 }
예제 #3
0
 public SocketIOPacket(string input)
 {
     _type = (SocketIOPacketType)int.Parse(new string(input[0], 1));
     _data = input.Substring(1);
 }