/// <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> /// 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()) { }
/// <summary>Constructor specifying the destination web socket location</summary> /// <param name="webSocketUrl"></param> /// <param name="subprotocols"></param> /// <param name="decoderConfig">Frames decoder configuration.</param> public WebSocketServerHandshaker07(string webSocketUrl, string subprotocols, WebSocketDecoderConfig decoderConfig) : base(WebSocketVersion.V07, webSocketUrl, subprotocols, decoderConfig) { }
/// <summary>Constructor specifying the destination web socket location</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="subprotocols">CSV of supported protocols</param> /// <param name="decoderConfig">Frames decoder configuration.</param> public WebSocketServerHandshaker13(string webSocketURL, string subprotocols, WebSocketDecoderConfig decoderConfig) : base(WebSocketVersion.V13, webSocketURL, subprotocols, decoderConfig) { }
/// <summary> /// Constructor specifying the destination web socket location /// </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="subprotocols">CSV of supported protocols</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 WebSocketServerHandshaker00(string webSocketUrl, string subprotocols, int maxFramePayloadLength) : base(WebSocketVersion.V00, webSocketUrl, subprotocols, WebSocketDecoderConfig.NewBuilder().MaxFramePayloadLength(maxFramePayloadLength).Build()) { }
/// <summary> /// Frames decoder configuration. /// </summary> public Builder DecoderConfig(WebSocketDecoderConfig decoderConfig) { _decoderConfig = decoderConfig ?? WebSocketDecoderConfig.Default; _decoderConfigBuilder = null; return(this); }