Пример #1
0
 private void OnDataReceived(byte[] data, int offset, int length)
 {
     while (true)
     {
         int left;
         WebSocketCommandInfo commandInfo = this.CommandReader.GetCommandInfo(data, offset, length, out left);
         if (this.CommandReader.NextCommandReader != null)
         {
             this.CommandReader = this.CommandReader.NextCommandReader;
         }
         if (commandInfo != null)
         {
             this.ExecuteCommand(commandInfo);
         }
         if (left > 0)
         {
             offset = offset + length - left;
             length = left;
         }
         else
         {
             break;
         }
     }
 }
Пример #2
0
        protected void ExecuteCommand(WebSocketCommandInfo commandInfo)
        {
            ICommand <WebSocket, WebSocketCommandInfo> command;

            if (!this.m_CommandDict.TryGetValue(commandInfo.Key, out command))
            {
                return;
            }
            command.ExecuteCommand(this, commandInfo);
        }