本文整理汇总了C#中WebSocketFrame类的典型用法代码示例。如果您正苦于以下问题:C# WebSocketFrame类的具体用法?C# WebSocketFrame怎么用?C# WebSocketFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebSocketFrame类属于命名空间,在下文中一共展示了WebSocketFrame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WebSocketFrameParseResult
public WebSocketFrameParseResult(WebSocketFrame webSocketFrame, byte[] overhead)
{
if (webSocketFrame == null) throw new ArgumentNullException(nameof(webSocketFrame));
if (overhead == null) throw new ArgumentNullException(nameof(overhead));
WebSocketFrame = webSocketFrame;
Overhead = overhead;
}
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:8,代码来源:WebSocketFrameParseResult.cs
示例2: MessageEventArgs
internal MessageEventArgs(WebSocketFrame frame)
{
_opcode = frame.Opcode;
_rawData = frame.PayloadData.ApplicationData;
_data = convertToString (_opcode, _rawData);
}
开发者ID:pedro-ramirez-suarez,项目名称:DiPS,代码行数:6,代码来源:MessageEventArgs.cs
示例3: checkIfValidReceivedFrame
private string checkIfValidReceivedFrame (WebSocketFrame frame)
{
var masked = frame.IsMasked;
return _client && masked
? "A frame from the server is masked."
: !_client && !masked
? "A frame from a client isn't masked."
: _inContinuation && frame.IsData
? "A data frame has been received while receiving the fragmented data."
: frame.IsCompressed && _compression == CompressionMethod.None
? "A compressed frame is without an available decompression method."
: null;
}
开发者ID:greeduomacro,项目名称:uomap-client,代码行数:13,代码来源:WebSocket.cs
示例4: processUnsupportedFrame
private bool processUnsupportedFrame (WebSocketFrame frame, CloseStatusCode code, string reason)
{
_logger.Debug ("An unsupported frame:" + frame.PrintToString (false));
processException (new WebSocketException (code, reason), null);
return false;
}
开发者ID:greeduomacro,项目名称:uomap-client,代码行数:7,代码来源:WebSocket.cs
示例5: processPongFrame
private bool processPongFrame (WebSocketFrame frame)
{
_receivePong.Set ();
_logger.Trace ("Received a Pong.");
return true;
}
开发者ID:greeduomacro,项目名称:uomap-client,代码行数:7,代码来源:WebSocket.cs
示例6: processFragmentedFrame
private bool processFragmentedFrame (WebSocketFrame frame)
{
if (!_inContinuation) {
// Must process first fragment.
if (frame.IsContinuation)
return true;
_fopcode = frame.Opcode;
_fragmentsBuffer = new MemoryStream ();
_inContinuation = true;
}
_fragmentsBuffer.WriteBytes (frame.PayloadData.ApplicationData);
if (frame.IsFinal) {
using (_fragmentsBuffer) {
var data = _compression != CompressionMethod.None
? _fragmentsBuffer.DecompressToArray (_compression)
: _fragmentsBuffer.ToArray ();
enqueueToMessageEventQueue (new MessageEventArgs (_fopcode, data));
}
_fragmentsBuffer = null;
_inContinuation = false;
}
return true;
}
开发者ID:greeduomacro,项目名称:uomap-client,代码行数:28,代码来源:WebSocket.cs
示例7: checkReceivedFrame
private bool checkReceivedFrame (WebSocketFrame frame, out string message)
{
message = null;
var masked = frame.IsMasked;
if (_client && masked) {
message = "A frame from the server is masked.";
return false;
}
if (!_client && !masked) {
message = "A frame from a client isn't masked.";
return false;
}
if (_inContinuation && frame.IsData) {
message = "A data frame has been received while receiving continuation frames.";
return false;
}
if (frame.IsCompressed && _compression == CompressionMethod.None) {
message = "A compressed frame has been received without any agreement for it.";
return false;
}
if (frame.Rsv2 == Rsv.On) {
message = "The RSV2 of a frame is non-zero without any negotiation for it.";
return false;
}
if (frame.Rsv3 == Rsv.On) {
message = "The RSV3 of a frame is non-zero without any negotiation for it.";
return false;
}
return true;
}
开发者ID:rejemy,项目名称:serverville-client-unity,代码行数:37,代码来源:WebSocket.cs
示例8: processFragmentedFrame
private bool processFragmentedFrame(WebSocketFrame frame)
{
return frame.IsContinuation // Not first fragment
? true
: processFragments(frame);
}
开发者ID:WJ-GitHub,项目名称:SocketHttpListener,代码行数:6,代码来源:WebSocket.cs
示例9: processPingFrame
private bool processPingFrame(WebSocketFrame frame)
{
var mask = Mask.Unmask;
return true;
}
开发者ID:WJ-GitHub,项目名称:SocketHttpListener,代码行数:6,代码来源:WebSocket.cs
示例10: send
private bool send(WebSocketFrame frame)
{
lock (_forConn) {
if (_readyState != WebSocketState.Open) {
_logger.Warn ("Sending has been interrupted.");
return false;
}
return _stream.Write (frame.ToByteArray ());
}
}
开发者ID:MylesBell,项目名称:Unity,代码行数:11,代码来源:WebSocket.cs
示例11: processCloseFrame
private bool processCloseFrame(WebSocketFrame frame)
{
var payload = frame.PayloadData;
close(payload, !payload.ContainsReservedCloseStatusCode, false);
return false;
}
开发者ID:WJ-GitHub,项目名称:SocketHttpListener,代码行数:7,代码来源:WebSocket.cs
示例12: acceptPingFrame
private bool acceptPingFrame(WebSocketFrame frame)
{
var mask = _client ? Mask.Mask : Mask.Unmask;
if (send (WebSocketFrame.CreatePongFrame (mask, frame.PayloadData)))
_logger.Trace ("Returned a Pong.");
return true;
}
开发者ID:MylesBell,项目名称:Unity,代码行数:8,代码来源:WebSocket.cs
示例13: OpCodeText
public void OpCodeText(object sender, FrameEventArgs e)
{
WebSocketFrame frame = new WebSocketFrame(ASCIIEncoding.UTF8.GetBytes("Echo: " + e.frame.PayloadAsUTF8()));
e.clientConnection.Send(frame.AsBytes());
}
开发者ID:Technicalfool,项目名称:Telemachus,代码行数:5,代码来源:MinimalWebSocketServerTest.cs
示例14: processCloseFrame
private bool processCloseFrame(WebSocketFrame frame)
{
enqueueToMessageEventQueue(new MessageEventArgs(frame));
return false;
}
开发者ID:cswiedler,项目名称:websocket-sharp,代码行数:6,代码来源:WebSocket.cs
示例15: processReceivedFrame
private bool processReceivedFrame (WebSocketFrame frame)
{
string msg;
if (!checkReceivedFrame (frame, out msg))
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
frame.Unmask ();
return frame.IsFragment
? processFragmentFrame (frame)
: frame.IsData
? processDataFrame (frame)
: frame.IsPing
? processPingFrame (frame)
: frame.IsPong
? processPongFrame (frame)
: frame.IsClose
? processCloseFrame (frame)
: processUnsupportedFrame (frame);
}
开发者ID:rejemy,项目名称:serverville-client-unity,代码行数:19,代码来源:WebSocket.cs
示例16: processPongFrame
private bool processPongFrame(WebSocketFrame frame)
{
_receivePong.Set();
return true;
}
开发者ID:WJ-GitHub,项目名称:SocketHttpListener,代码行数:6,代码来源:WebSocket.cs
示例17: processUnsupportedFrame
private bool processUnsupportedFrame (WebSocketFrame frame)
{
_logger.Fatal ("An unsupported frame:" + frame.PrintToString (false));
fatal ("There is no way to handle it.", CloseStatusCode.PolicyViolation);
return false;
}
开发者ID:rejemy,项目名称:serverville-client-unity,代码行数:7,代码来源:WebSocket.cs
示例18: processUnsupportedFrame
private bool processUnsupportedFrame(WebSocketFrame frame, CloseStatusCode code, string reason)
{
processException(new WebSocketException(code, reason), null);
return false;
}
开发者ID:WJ-GitHub,项目名称:SocketHttpListener,代码行数:6,代码来源:WebSocket.cs
示例19: MessageEventArgs
internal MessageEventArgs(WebSocketFrame frame)
{
_opcode = frame.Opcode;
_rawData = frame.PayloadData.ApplicationData;
}
开发者ID:cliftonm,项目名称:clifton,代码行数:5,代码来源:MessageEventArgs.cs
示例20: processWebSocketFrame
private bool processWebSocketFrame(WebSocketFrame frame)
{
return frame.IsCompressed && _compression == CompressionMethod.None
? processUnsupportedFrame(
frame,
CloseStatusCode.IncorrectData,
"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)
: frame.IsClose
? processCloseFrame(frame)
: processUnsupportedFrame(frame, CloseStatusCode.PolicyViolation, null);
}
开发者ID:WJ-GitHub,项目名称:SocketHttpListener,代码行数:19,代码来源:WebSocket.cs
注:本文中的WebSocketFrame类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论