예제 #1
0
 public WebSocketClientProtocolHandler(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                       bool allowExtensions, HttpHeaders customHeaders,
                                       int maxFramePayloadLength, bool handleCloseFrames,
                                       bool performMasking, bool allowMaskMismatch)
     : this(WebSocketClientHandshakerFactory.NewHandshaker(webSocketUrl, version, subprotocol,
                                                           allowExtensions, customHeaders, maxFramePayloadLength,
                                                           performMasking, allowMaskMismatch), handleCloseFrames)
 {
 }
 /// <summary>Base constructor</summary>
 /// <param name="webSocketUrl">URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
 /// sent to this URL.</param>
 /// <param name="version">Version of web socket specification to use to connect to the server</param>
 /// <param name="subprotocol"></param>
 /// <param name="allowExtensions">Sub protocol request sent to the server.</param>
 /// <param name="customHeaders">Map of custom headers to add to the client request</param>
 /// <param name="maxFramePayloadLength">Maximum length of a frame's payload</param>
 /// <param name="handleCloseFrames"><c>true</c> if close frames should not be forwarded and just close the channel</param>
 /// <param name="performMasking">Whether to mask all written websocket frames. This must be set to true in order to be fully compatible
 /// with the websocket specifications. Client applications that communicate with a non-standard server
 /// which doesn't require masking might set this to false to achieve a higher performance.</param>
 /// <param name="allowMaskMismatch">When set to true, frames which are not masked properly according to the standard will still be
 /// accepted.</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(
     Uri webSocketUrl, WebSocketVersion version, string subprotocol,
     bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
     bool handleCloseFrames, bool performMasking, bool allowMaskMismatch,
     long handshakeTimeoutMillis, bool enableUtf8Validator = true)
     : this(WebSocketClientHandshakerFactory.NewHandshaker(webSocketUrl, version, subprotocol,
                                                           allowExtensions, customHeaders, maxFramePayloadLength, performMasking, allowMaskMismatch),
            handleCloseFrames, WebSocketClientProtocolConfig.DefaultDropPongFrames, handshakeTimeoutMillis, enableUtf8Validator)
 {
 }
 /// <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;
 }