Esempio n. 1
0
        public static async Task Handle(string rawMessage, PrimusClient client)
        {
            if (string.IsNullOrWhiteSpace(rawMessage))
            {
                await client.Close();

                return;
            }

            if (PrimusClient.SocketType == SocketTypeEnum.ENGINE_IO && client != null)
            {
                if (!byte.TryParse(rawMessage[0].ToString(), out byte messageTypeValue))
                {
                    await client.Close();

                    return;
                }

                EngineIOMessageTypeEnum messageType = (EngineIOMessageTypeEnum)messageTypeValue;
                if (messageTypeValue < (int)EngineIOMessageTypeEnum.OPENING || messageTypeValue > (int)EngineIOMessageTypeEnum.HANDSHAKE_COMPLETE || messageType == EngineIOMessageTypeEnum.CLOSE)
                {
                    await client.Close();

                    return;
                }

                rawMessage = rawMessage[1..];
Esempio n. 2
0
 public static string GetWSValue(this EngineIOMessageTypeEnum value)
 {
     return(((int)value).ToString());
 }
 public EngineIOMessageTypeAttribute(EngineIOMessageTypeEnum value)
 {
     Value = value;
 }