当前位置: 首页>>代码示例>>C#>>正文


C# WsFrame类代码示例

本文整理汇总了C#中WsFrame的典型用法代码示例。如果您正苦于以下问题:C# WsFrame类的具体用法?C# WsFrame怎么用?C# WsFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WsFrame类属于命名空间,在下文中一共展示了WsFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: processClose

        private bool processClose(WsFrame frame)
        {
            if (!frame.IsClose)
            return false;

              #if DEBUG
              Console.WriteLine("WS: [email protected]: Start closing handshake.");
              #endif
              close(frame.PayloadData);

              return true;
        }
开发者ID:johlo,项目名称:websocket-sharp,代码行数:12,代码来源:WebSocket.cs

示例2: processFrame

 private bool processFrame(WsFrame frame)
 {
     return frame.IsCompressed && _compression == CompressionMethod.NONE
      ? processUnsupportedFrame (
          frame,
          CloseStatusCode.INCORRECT_DATA,
          "A compressed data has been received without available decompression method.")
      : frame.IsFragmented
        ? processFragmentedFrame (frame)
        : frame.IsData
          ? processDataFrame (frame)
          : frame.IsPing
            ? processPingFrame (frame)
            : frame.IsPong
              ? processPongFrame ()
              : frame.IsClose
                ? processCloseFrame (frame)
                : processUnsupportedFrame (frame, CloseStatusCode.POLICY_VIOLATION, null);
 }
开发者ID:kevleyski,项目名称:websocket-sharp,代码行数:19,代码来源:WebSocket.cs

示例3: processUnsupportedFrame

        private bool processUnsupportedFrame(WsFrame frame, CloseStatusCode code, string reason)
        {
            _logger.Debug ("Unsupported frame:\n" + frame.PrintToString (false));
              processException (new WebSocketException (code, reason), null);

              return false;
        }
开发者ID:kevleyski,项目名称:websocket-sharp,代码行数:7,代码来源:WebSocket.cs

示例4: processCloseFrame

        private bool processCloseFrame(WsFrame frame)
        {
            var payload = frame.PayloadData;
              close (payload, !payload.ContainsReservedCloseStatusCode, false);

              return false;
        }
开发者ID:kevleyski,项目名称:websocket-sharp,代码行数:7,代码来源:WebSocket.cs

示例5: processFragmentedFrame

 private bool processFragmentedFrame(WsFrame frame)
 {
     return frame.IsContinuation // Not first fragment
      ? true
      : processFragments (frame);
 }
开发者ID:kevleyski,项目名称:websocket-sharp,代码行数:6,代码来源:WebSocket.cs

示例6: acceptFrame

 private bool acceptFrame(WsFrame frame)
 {
     return frame.IsCompressed && _compression == CompressionMethod.None
      ? acceptUnsupportedFrame (
          frame,
          CloseStatusCode.IncorrectData,
          "A compressed data has been received without available decompression method.")
      : frame.IsFragmented
        ? acceptFragmentedFrame (frame)
        : frame.IsData
          ? acceptDataFrame (frame)
          : frame.IsPing
            ? acceptPingFrame (frame)
            : frame.IsPong
              ? acceptPongFrame (frame)
              : frame.IsClose
                ? acceptCloseFrame (frame)
                : acceptUnsupportedFrame (frame, CloseStatusCode.PolicyViolation, null);
 }
开发者ID:jijamw,项目名称:websocket-sharp,代码行数:19,代码来源:WebSocket.cs

示例7: acceptPongFrame

        private bool acceptPongFrame(WsFrame frame)
        {
            _receivePong.Set ();
              _logger.Trace ("Received a Pong.");

              return true;
        }
开发者ID:jijamw,项目名称:websocket-sharp,代码行数:7,代码来源:WebSocket.cs

示例8: processFragmented

        private bool processFragmented(WsFrame frame)
        {
            // Not first fragment
              if (frame.IsContinuation)
            return true;

              // Not fragmented
              if (frame.IsFinal)
            return false;

              bool incorrect = !frame.IsData ||
                       (frame.IsCompressed && _compression == CompressionMethod.NONE);

              if (!incorrect)
            processFragments (frame);
              else
            processIncorrectFrame ();

              return true;
        }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:20,代码来源:WebSocket.cs

示例9: processFrame

        private void processFrame(WsFrame frame)
        {
            bool processed = processAbnormal (frame) ||
                       processFragmented (frame) ||
                       processData (frame) ||
                       processPing (frame) ||
                       processPong (frame) ||
                       processClose (frame);

              if (!processed)
            processIncorrectFrame ();
        }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:12,代码来源:WebSocket.cs

示例10: processClose

        private bool processClose(WsFrame frame)
        {
            if (!frame.IsClose)
            return false;

              _logger.Trace ("Start closing handshake.");
              close (frame.PayloadData);

              return true;
        }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:10,代码来源:WebSocket.cs

示例11: processData

        private bool processData(WsFrame frame)
        {
            if (!frame.IsData)
            return false;

              if (frame.IsCompressed && _compression == CompressionMethod.NONE)
            return false;

              var args = frame.IsCompressed
               ? new MessageEventArgs (
                   frame.Opcode, frame.PayloadData.ApplicationData.Decompress (_compression))
               : new MessageEventArgs (frame.Opcode, frame.PayloadData);

              OnMessage.Emit (this, args);
              return true;
        }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:16,代码来源:WebSocket.cs

示例12: processAbnormal

        private bool processAbnormal(WsFrame frame)
        {
            if (frame != null)
            return false;

              _logger.Trace ("Start closing handshake.");
              var code = CloseStatusCode.ABNORMAL;
              Close (code, code.GetMessage ());

              return true;
        }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:11,代码来源:WebSocket.cs

示例13: processPong

        private bool processPong(WsFrame frame)
        {
            if (!frame.IsPong)
            return false;

              #if DEBUG
              Console.WriteLine("WS: [email protected]: Receive Pong.");
              #endif
              _receivePong.Set();

              return true;
        }
开发者ID:johlo,项目名称:websocket-sharp,代码行数:12,代码来源:WebSocket.cs

示例14: processPing

        private bool processPing(WsFrame frame)
        {
            if (!frame.IsPing)
            return false;

              #if DEBUG
              Console.WriteLine("WS: [email protected]: Return Pong.");
              #endif
              pong(frame.PayloadData);

              return true;
        }
开发者ID:johlo,项目名称:websocket-sharp,代码行数:12,代码来源:WebSocket.cs

示例15: acceptDataFrame

        private bool acceptDataFrame(WsFrame frame)
        {
            var args = frame.IsCompressed
                 ? new MessageEventArgs (
                     frame.Opcode, frame.PayloadData.ApplicationData.Decompress (_compression))
                 : new MessageEventArgs (frame.Opcode, frame.PayloadData);

              if (_readyState == WebSocketState.Open)
            OnMessage.Emit (this, args);

              return true;
        }
开发者ID:jijamw,项目名称:websocket-sharp,代码行数:12,代码来源:WebSocket.cs


注:本文中的WsFrame类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。