• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WsFrame类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: processPing

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

              _logger.Trace ("Return Pong.");
              pong (frame.PayloadData);

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


示例17: acceptFragmentedFrame

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


示例18: processPong

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

              _logger.Trace ("Receive Pong.");
              _receivePong.Set ();

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


示例19: acceptPingFrame

        private bool acceptPingFrame(WsFrame frame)
        {
            var mask = _client ? Mask.Mask : Mask.Unmask;
              if (send (WsFrame.CreatePongFrame (mask, frame.PayloadData)))
            _logger.Trace ("Returned a Pong.");

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


示例20: send

        private bool send(WsFrame frame)
        {
            lock (_forFrame)
              {
            var ready = _stream == null
                    ? false
                    : _readyState == WebSocketState.OPEN
                      ? true
                      : _readyState == WebSocketState.CLOSING
                        ? frame.IsClose
                        : false;

            if (!ready)
            {
              var msg = "The WebSocket connection isn't established or has been closed.";
              _logger.Error (msg);
              error (msg);

              return false;
            }

            return _stream.WriteFrame (frame);
              }
        }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:24,代码来源:WebSocket.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WsProxy类代码示例发布时间:2022-05-24
下一篇:
C# WritingSystemDefinition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap