예제 #1
0
        internal WebSocketClientProtocolHandshakeHandler(WebSocketClientHandshaker handshaker, long handshakeTimeoutMillis)
        {
            if (handshakeTimeoutMillis <= 0L)
            {
                ThrowHelper.ThrowArgumentException_Positive(handshakeTimeoutMillis, ExceptionArgument.handshakeTimeoutMillis);
            }

            _handshaker             = handshaker;
            _handshakeTimeoutMillis = handshakeTimeoutMillis;
        }
        /// <summary>Base constructor</summary>
        /// <param name="handshaker">The <see cref="WebSocketClientHandshaker"/> which will be used to issue the handshake once the connection
        /// was established to the remote peer.</param>
        /// <param name="handleCloseFrames"><c>true</c> if close frames should not be forwarded and just close the channel</param>
        /// <param name="dropPongFrames"><c>true</c> if pong frames should not be forwarded</param>
        /// <param name="handshakeTimeoutMillis">Handshake timeout in mills, when handshake timeout, will trigger user
        /// event <see cref="ClientHandshakeStateEvent.HandshakeTimeout"/></param>
        /// <param name="enableUtf8Validator"></param>
        public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker,
                                              bool handleCloseFrames, bool dropPongFrames, long handshakeTimeoutMillis, bool enableUtf8Validator = true)
            : base(dropPongFrames)
        {
            if (handshakeTimeoutMillis <= 0L)
            {
                ThrowHelper.ThrowArgumentException_Positive(handshakeTimeoutMillis, ExceptionArgument.handshakeTimeoutMillis);
            }

            _handshaker   = handshaker;
            _clientConfig = WebSocketClientProtocolConfig.NewBuilder()
                            .HandleCloseFrames(handleCloseFrames)
                            .HandshakeTimeoutMillis(handshakeTimeoutMillis)
                            .WithUTF8Validator(enableUtf8Validator)
                            .Build();
        }
 /// <summary>Base constructor</summary>
 /// <param name="clientConfig">Client protocol configuration.</param>
 public WebSocketClientProtocolHandler(WebSocketClientProtocolConfig clientConfig)
     : base(CheckNotNull(clientConfig).DropPongFrames, clientConfig.SendCloseFrame, clientConfig.ForceCloseTimeoutMillis)
 {
     _handshaker = WebSocketClientHandshakerFactory.NewHandshaker(
         clientConfig.WebSocketUri,
         clientConfig.Version,
         clientConfig.Subprotocol,
         clientConfig.AllowExtensions,
         clientConfig.CustomHeaders,
         clientConfig.MaxFramePayloadLength,
         clientConfig.PerformMasking,
         clientConfig.AllowMaskMismatch,
         clientConfig.ForceCloseTimeoutMillis,
         clientConfig.AbsoluteUpgradeUrl
         );
     _clientConfig = clientConfig;
 }
 /// <summary>Base constructor</summary>
 /// <param name="handshaker">The <see cref="WebSocketClientHandshaker"/> which will be used to issue the handshake once the connection
 /// was established to the remote peer.</param>
 /// <param name="handleCloseFrames"><c>true</c> if close frames should not be forwarded and just close the channel</param>
 /// <param name="dropPongFrames"><c>true</c> if pong frames should not be forwarded</param>
 /// <param name="enableUtf8Validator"></param>
 public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker,
                                       bool handleCloseFrames, bool dropPongFrames, bool enableUtf8Validator = true)
     : this(handshaker, handleCloseFrames, dropPongFrames, WebSocketClientProtocolConfig.DefaultHandshakeTimeoutMillis, enableUtf8Validator)
 {
 }
예제 #5
0
 public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker)
     : this(handshaker, true)
 {
 }
예제 #6
0
 public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, bool handleCloseFrames)
 {
     this.handshaker        = handshaker;
     this.handleCloseFrames = handleCloseFrames;
 }
예제 #7
0
 internal WebSocketClientProtocolHandshakeHandler(WebSocketClientHandshaker handshaker)
 {
     this.handshaker = handshaker;
 }
예제 #8
0
 internal WebSocketClientProtocolHandshakeHandler(WebSocketClientHandshaker handshaker)
     : this(handshaker, DefaultHandshakeTimeoutMs)
 {
 }