Пример #1
0
            internal Builder(WebSocketClientProtocolConfig clientConfig)
            {
                if (clientConfig is null)
                {
                    ThrowHelper.ThrowArgumentNullException(ExceptionArgument.clientConfig);
                }

                _webSocketUri            = clientConfig.WebSocketUri;
                _subprotocol             = clientConfig.Subprotocol;
                _version                 = clientConfig.Version;
                _allowExtensions         = clientConfig.AllowExtensions;
                _customHeaders           = clientConfig.CustomHeaders;
                _maxFramePayloadLength   = clientConfig.MaxFramePayloadLength;
                _performMasking          = clientConfig.PerformMasking;
                _allowMaskMismatch       = clientConfig.AllowMaskMismatch;
                _handleCloseFrames       = clientConfig.HandleCloseFrames;
                _sendCloseFrame          = clientConfig.SendCloseFrame;
                _dropPongFrames          = clientConfig.DropPongFrames;
                _handshakeTimeoutMillis  = clientConfig.HandshakeTimeoutMillis;
                _forceCloseTimeoutMillis = clientConfig.ForceCloseTimeoutMillis;
                _absoluteUpgradeUrl      = clientConfig.AbsoluteUpgradeUrl;
                _withUTF8Validator       = clientConfig.WithUTF8Validator;
            }
Пример #2
0
 public CorruptedWebSocketFrameException(WebSocketCloseStatus status, string message, Exception cause)
     : base(message is null ? status.ReasonText.ToString() : message, cause)
 {
     CloseStatus = status;
 }
Пример #3
0
 public CorruptedWebSocketFrameException(WebSocketCloseStatus status, Exception cause)
     : this(status, null, cause)
 {
 }
Пример #4
0
 public CorruptedWebSocketFrameException(WebSocketCloseStatus status, string message)
     : this(status, message, null)
 {
 }
Пример #5
0
 /// <summary>
 /// Creates a new empty close frame with closing status code and reason text
 /// </summary>
 /// <param name="status">Status code as per <a href="http://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. For
 /// example, <tt>1000</tt> indicates normal closure.</param>
 /// <param name="reasonText">Reason text. Set to null if no text.</param>
 public CloseWebSocketFrame(WebSocketCloseStatus status, ICharSequence reasonText)
     : this(status.Code, reasonText)
 {
 }
Пример #6
0
 /// <summary>
 /// Creates a new empty close frame with closing status code and reason text
 /// </summary>
 /// <param name="status">Status code as per <a href="http://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. For
 /// example, <tt>1000</tt> indicates normal closure.</param>
 public CloseWebSocketFrame(WebSocketCloseStatus status)
     : this(status.Code, status.ReasonText)
 {
 }
 /// <summary>
 /// Close frame to send, when close frame was not send manually. Or <c>null</c> to disable proper close.
 /// </summary>
 public Builder SendCloseFrame(WebSocketCloseStatus sendCloseFrame)
 {
     _sendCloseFrame = sendCloseFrame;
     return(this);
 }
Пример #8
0
 internal void ProtocolViolation0(IChannelHandlerContext ctx, IByteBuffer input, WebSocketCloseStatus status, string reason)
 {
     ProtocolViolation(ctx, input, new CorruptedWebSocketFrameException(status, reason));
 }