Exemple #1
0
        public static WebSocketClientHandshaker NewHandshaker(
            Uri webSocketUrl, WebSocketVersion version, string subprotocol,
            bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
            bool performMasking, bool allowMaskMismatch)
        {
            if (version == V13)
            {
                return(new WebSocketClientHandshaker13(
                           webSocketUrl, V13, subprotocol, allowExtensions, customHeaders,
                           maxFramePayloadLength, performMasking, allowMaskMismatch));
            }
            if (version == V08)
            {
                return(new WebSocketClientHandshaker08(
                           webSocketUrl, V08, subprotocol, allowExtensions, customHeaders,
                           maxFramePayloadLength, performMasking, allowMaskMismatch));
            }
            if (version == V07)
            {
                return(new WebSocketClientHandshaker07(
                           webSocketUrl, V07, subprotocol, allowExtensions, customHeaders,
                           maxFramePayloadLength, performMasking, allowMaskMismatch));
            }
            if (version == V00)
            {
                return(new WebSocketClientHandshaker00(
                           webSocketUrl, V00, subprotocol, customHeaders, maxFramePayloadLength));
            }

            throw new WebSocketHandshakeException($"Protocol version {version}not supported.");
        }
 internal Builder(
     Uri webSocketUri,
     string subprotocol,
     WebSocketVersion version,
     bool allowExtensions,
     HttpHeaders customHeaders,
     int maxFramePayloadLength,
     bool performMasking,
     bool allowMaskMismatch,
     bool handleCloseFrames,
     WebSocketCloseStatus sendCloseFrame,
     bool dropPongFrames,
     long handshakeTimeoutMillis,
     long forceCloseTimeoutMillis,
     bool absoluteUpgradeUrl,
     bool withUTF8Validator)
 {
     _webSocketUri            = webSocketUri;
     _subprotocol             = subprotocol;
     _version                 = version;
     _allowExtensions         = allowExtensions;
     _customHeaders           = customHeaders;
     _maxFramePayloadLength   = maxFramePayloadLength;
     _performMasking          = performMasking;
     _allowMaskMismatch       = allowMaskMismatch;
     _handleCloseFrames       = handleCloseFrames;
     _sendCloseFrame          = sendCloseFrame;
     _dropPongFrames          = dropPongFrames;
     _handshakeTimeoutMillis  = handshakeTimeoutMillis;
     _forceCloseTimeoutMillis = forceCloseTimeoutMillis;
     _absoluteUpgradeUrl      = absoluteUpgradeUrl;
     _withUTF8Validator       = withUTF8Validator;
 }
Exemple #3
0
 public WebSocketClientProtocolHandler(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                       bool allowExtensions, HttpHeaders customHeaders,
                                       int maxFramePayloadLength, bool handleCloseFrames)
     : this(webSocketUrl, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength,
            handleCloseFrames, true, false)
 {
 }
 /// <summary>Creates a new instance.</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">Sub protocol request sent to the server.</param>
 /// <param name="allowExtensions">Allow extensions to be used in the reserved bits of the web socket frame</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="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>
 public WebSocketClientHandshaker13(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                    bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
                                    bool performMasking, bool allowMaskMismatch)
     : this(webSocketUrl, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength,
            performMasking, allowMaskMismatch, DefaultForceCloseTimeoutMillis)
 {
 }
        /// <summary>Creates a new handshaker.</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">Sub protocol request sent to the server. Null if no sub-protocol support is required.</param>
        /// <param name="allowExtensions">Allow extensions to be used in the reserved bits of the web socket frame</param>
        /// <param name="customHeaders">Custom HTTP headers to send during the handshake</param>
        /// <param name="maxFramePayloadLength">Maximum allowable frame payload length. Setting this value to your application's
        /// requirement may reduce denial of service attacks using long data frames.</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="forceCloseTimeoutMillis">Close the connection if it was not closed by the server after timeout specified</param>
        /// <returns></returns>
        public static WebSocketClientHandshaker NewHandshaker(
            Uri webSocketUrl, WebSocketVersion version, string subprotocol,
            bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
            bool performMasking, bool allowMaskMismatch, long forceCloseTimeoutMillis)
        {
            if (version == V13)
            {
                return(new WebSocketClientHandshaker13(
                           webSocketUrl, V13, subprotocol, allowExtensions, customHeaders,
                           maxFramePayloadLength, performMasking, allowMaskMismatch, forceCloseTimeoutMillis));
            }
            if (version == V08)
            {
                return(new WebSocketClientHandshaker08(
                           webSocketUrl, V08, subprotocol, allowExtensions, customHeaders,
                           maxFramePayloadLength, performMasking, allowMaskMismatch, forceCloseTimeoutMillis));
            }
            if (version == V07)
            {
                return(new WebSocketClientHandshaker07(
                           webSocketUrl, V07, subprotocol, allowExtensions, customHeaders,
                           maxFramePayloadLength, performMasking, allowMaskMismatch, forceCloseTimeoutMillis));
            }
            if (version == V00)
            {
                return(new WebSocketClientHandshaker00(
                           webSocketUrl, V00, subprotocol, customHeaders,
                           maxFramePayloadLength, forceCloseTimeoutMillis));
            }

            return(ThrowHelper.FromWebSocketHandshakeException_InvalidVersion(version));
        }
 static void ThrowIfUnknown(WebSocketVersion webSocketVersion)
 {
     if (webSocketVersion == Unknown)
     {
         throw new InvalidOperationException("Unknown web socket version");
     }
 }
 /// <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="enableUtf8Validator"></param>
 public WebSocketClientProtocolHandler(
     Uri webSocketUrl, WebSocketVersion version, string subprotocol,
     bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
     bool enableUtf8Validator = true)
     : this(webSocketUrl, version, subprotocol,
            allowExtensions, customHeaders, maxFramePayloadLength, WebSocketClientProtocolConfig.DefaultHandshakeTimeoutMillis, enableUtf8Validator)
 {
 }
 /// <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="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, long handshakeTimeoutMillis, bool enableUtf8Validator = true)
     : this(webSocketUrl, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength,
            handleCloseFrames, WebSocketClientProtocolConfig.DefaultPerformMasking, WebSocketClientProtocolConfig.DefaultAllowMaskMismatch, handshakeTimeoutMillis, enableUtf8Validator)
 {
 }
Exemple #9
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)
 {
 }
Exemple #10
0
 public WebSocketClientHandshaker07(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                    bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
                                    bool performMasking, bool allowMaskMismatch)
     : base(webSocketUrl, version, subprotocol, customHeaders, maxFramePayloadLength)
 {
     this.allowExtensions   = allowExtensions;
     this.performMasking    = performMasking;
     this.allowMaskMismatch = allowMaskMismatch;
 }
Exemple #11
0
 protected WebSocketClientHandshaker(Uri uri, WebSocketVersion version, string subprotocol,
                                     HttpHeaders customHeaders, int maxFramePayloadLength)
 {
     this.uri                   = uri;
     this.version               = version;
     this.expectedSubprotocol   = subprotocol;
     this.CustomHeaders         = customHeaders;
     this.maxFramePayloadLength = maxFramePayloadLength;
 }
Exemple #12
0
 /// <summary>Base constructor</summary>
 /// <param name="uri">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">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="forceCloseTimeoutMillis">Close the connection if it was not closed by the server after timeout specified</param>
 /// <param name="absoluteUpgradeUrl">Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over
 /// clear HTTP</param>
 protected WebSocketClientHandshaker(Uri uri, WebSocketVersion version, string subprotocol,
                                     HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis, bool absoluteUpgradeUrl)
 {
     _uri                     = uri;
     _version                 = version;
     _expectedSubprotocol     = subprotocol;
     CustomHeaders            = customHeaders;
     _maxFramePayloadLength   = maxFramePayloadLength;
     _forceCloseTimeoutMillis = forceCloseTimeoutMillis;
     _absoluteUpgradeUrl      = absoluteUpgradeUrl;
 }
 /// <summary>Creates a new instance.</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">Sub protocol request sent to the server.</param>
 /// <param name="allowExtensions">Allow extensions to be used in the reserved bits of the web socket frame</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="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="forceCloseTimeoutMillis">Close the connection if it was not closed by the server after timeout specified.</param>
 /// <param name="absoluteUpgradeUrl">Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over
 /// clear HTTP</param>
 public WebSocketClientHandshaker13(
     Uri webSocketUrl, WebSocketVersion version, string subprotocol,
     bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
     bool performMasking, bool allowMaskMismatch,
     long forceCloseTimeoutMillis, bool absoluteUpgradeUrl)
     : base(webSocketUrl, version, subprotocol, customHeaders, maxFramePayloadLength,
            forceCloseTimeoutMillis, absoluteUpgradeUrl)
 {
     _allowExtensions   = allowExtensions;
     _performMasking    = performMasking;
     _allowMaskMismatch = allowMaskMismatch;
 }
Exemple #14
0
 protected WebSocketServerHandshaker(WebSocketVersion version, string uri, string subprotocols, int maxFramePayloadLength)
 {
     this.version = version;
     this.uri     = uri;
     if (subprotocols != null)
     {
         string[] subprotocolArray = subprotocols.Split(',');
         for (int i = 0; i < subprotocolArray.Length; i++)
         {
             subprotocolArray[i] = subprotocolArray[i].Trim();
         }
         this.subprotocols = subprotocolArray;
     }
     else
     {
         this.subprotocols = EmptyArrays.EmptyStrings;
     }
     this.maxFramePayloadLength = maxFramePayloadLength;
 }
        private WebSocketClientProtocolConfig(
            Uri webSocketUri,
            string subprotocol,
            WebSocketVersion version,
            bool allowExtensions,
            HttpHeaders customHeaders,
            int maxFramePayloadLength,
            bool performMasking,
            bool allowMaskMismatch,
            bool handleCloseFrames,
            WebSocketCloseStatus sendCloseFrame,
            bool dropPongFrames,
            long handshakeTimeoutMillis,
            long forceCloseTimeoutMillis,
            bool absoluteUpgradeUrl,
            bool withUTF8Validator
            )
        {
            if (handshakeTimeoutMillis <= 0L)
            {
                ThrowHelper.ThrowArgumentException_Positive(ExceptionArgument.handshakeTimeoutMillis);
            }

            WebSocketUri            = webSocketUri;
            Subprotocol             = subprotocol;
            Version                 = version;
            AllowExtensions         = allowExtensions;
            CustomHeaders           = customHeaders;
            MaxFramePayloadLength   = maxFramePayloadLength;
            PerformMasking          = performMasking;
            AllowMaskMismatch       = allowMaskMismatch;
            ForceCloseTimeoutMillis = forceCloseTimeoutMillis;
            HandleCloseFrames       = handleCloseFrames;
            SendCloseFrame          = sendCloseFrame;
            DropPongFrames          = dropPongFrames;
            HandshakeTimeoutMillis  = handshakeTimeoutMillis;
            AbsoluteUpgradeUrl      = absoluteUpgradeUrl;
            WithUTF8Validator       = withUTF8Validator;
        }
            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;
            }
        /// <summary>
        /// Constructor specifying the destination web socket location
        /// </summary>
        /// <param name="version">the protocol version</param>
        /// <param name="uri">URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
        /// sent to this URL.</param>
        /// <param name="subprotocols">CSV of supported protocols. Null if sub protocols not supported.</param>
        /// <param name="decoderConfig">Frames decoder configuration.</param>
        protected WebSocketServerHandshaker(WebSocketVersion version, string uri, string subprotocols, WebSocketDecoderConfig decoderConfig)
        {
            if (decoderConfig is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.decoderConfig);
            }

            _version = version;
            _uri     = uri;
            if (subprotocols is object)
            {
                string[] subprotocolArray = subprotocols.Split(',');
                for (int i = 0; i < subprotocolArray.Length; i++)
                {
                    subprotocolArray[i] = subprotocolArray[i].Trim();
                }
                _subprotocols = subprotocolArray;
            }
            else
            {
                _subprotocols = EmptyArrays.EmptyStrings;
            }
            _decoderConfig = decoderConfig;
        }
 /// <summary>
 /// Version of web socket specification to use to connect to the server
 /// </summary>
 public Builder Version(WebSocketVersion version)
 {
     _version = version;
     return(this);
 }
Exemple #19
0
 /// <summary>Creates a new instance with the specified destination WebSocket location and version to initiate.</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">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>
 public WebSocketClientHandshaker00(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                    HttpHeaders customHeaders, int maxFramePayloadLength)
     : this(webSocketUrl, version, subprotocol, customHeaders, maxFramePayloadLength, DefaultForceCloseTimeoutMillis)
 {
 }
 /// <summary>Creates a new handshaker.</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">Sub protocol request sent to the server. Null if no sub-protocol support is required.</param>
 /// <param name="allowExtensions">Allow extensions to be used in the reserved bits of the web socket frame</param>
 /// <param name="customHeaders">Custom HTTP headers to send during the handshake</param>
 /// <param name="maxFramePayloadLength">Maximum allowable frame payload length. Setting this value to your application's
 /// requirement may reduce denial of service attacks using long data frames.</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>
 public static WebSocketClientHandshaker NewHandshaker(
     Uri webSocketUrl, WebSocketVersion version, string subprotocol,
     bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength,
     bool performMasking, bool allowMaskMismatch)
 => NewHandshaker(webSocketUrl, version, subprotocol, allowExtensions, customHeaders,
                  maxFramePayloadLength, performMasking, allowMaskMismatch, -1);
 /// <summary>Creates a new handshaker.</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">Sub protocol request sent to the server. Null if no sub-protocol support is required.</param>
 /// <param name="allowExtensions">Allow extensions to be used in the reserved bits of the web socket frame</param>
 /// <param name="customHeaders">Custom HTTP headers to send during the handshake</param>
 /// <param name="maxFramePayloadLength">Maximum allowable frame payload length. Setting this value to your application's
 /// requirement may reduce denial of service attacks using long data frames.</param>
 public static WebSocketClientHandshaker NewHandshaker(Uri webSocketUrl, WebSocketVersion version, string subprotocol, bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength)
 => NewHandshaker(webSocketUrl, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false);
 /// <summary>Creates a new handshaker.</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">Sub protocol request sent to the server. Null if no sub-protocol support is required.</param>
 /// <param name="allowExtensions">Allow extensions to be used in the reserved bits of the web socket frame</param>
 /// <param name="customHeaders">Custom HTTP headers to send during the handshake</param>
 public static WebSocketClientHandshaker NewHandshaker(Uri webSocketUrl, WebSocketVersion version, string subprotocol, bool allowExtensions, HttpHeaders customHeaders) =>
 NewHandshaker(webSocketUrl, version, subprotocol, allowExtensions, customHeaders, 65536);
Exemple #23
0
 /// <summary>Creates a new instance with the specified destination WebSocket location and version to initiate.</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">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="forceCloseTimeoutMillis">Close the connection if it was not closed by the server after timeout specified</param>
 internal WebSocketClientHandshaker00(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                      HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis)
     : this(webSocketUrl, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, false)
 {
 }
 public WebSocketClientHandshaker00(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                    HttpHeaders customHeaders, int maxFramePayloadLength)
     : base(webSocketUrl, version, subprotocol, customHeaders, maxFramePayloadLength)
 {
 }
Exemple #25
0
 /// <summary>Creates a new instance with the specified destination WebSocket location and version to initiate.</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">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="forceCloseTimeoutMillis">Close the connection if it was not closed by the server after timeout specified</param>
 /// <param name="absoluteUpgradeUrl">Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over
 /// clear HTTP</param>
 internal WebSocketClientHandshaker00(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                      HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis, bool absoluteUpgradeUrl)
     : base(webSocketUrl, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl)
 {
 }
Exemple #26
0
 /// <summary>Base constructor</summary>
 /// <param name="uri">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">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="forceCloseTimeoutMillis">Close the connection if it was not closed by the server after timeout specified</param>
 protected WebSocketClientHandshaker(Uri uri, WebSocketVersion version, string subprotocol,
                                     HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis)
     : this(uri, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, false)
 {
 }
Exemple #27
0
 /// <summary>Creates a new instance.</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">Sub protocol request sent to the server.</param>
 /// <param name="allowExtensions">Allow extensions to be used in the reserved bits of the web socket frame</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>
 public WebSocketClientHandshaker08(Uri webSocketUrl, WebSocketVersion version, string subprotocol,
                                    bool allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength)
     : this(webSocketUrl, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true,
            false, DefaultForceCloseTimeoutMillis)
 {
 }
 /// <summary>
 /// Constructor specifying the destination web socket location
 /// </summary>
 /// <param name="version">the protocol version</param>
 /// <param name="uri">URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
 /// sent to this URL.</param>
 /// <param name="subprotocols">CSV of supported protocols. Null if sub protocols not supported.</param>
 /// <param name="maxFramePayloadLength">Maximum length of a frame's payload</param>
 protected WebSocketServerHandshaker(WebSocketVersion version, string uri, string subprotocols, int maxFramePayloadLength)
     : this(version, uri, subprotocols, WebSocketDecoderConfig.NewBuilder().MaxFramePayloadLength(maxFramePayloadLength).Build())
 {
 }