src/packages/EmbedIO/WebSockets/WebSocketModule.cs
/// <summary>
/// Adds one or more WebSocket subprotocols to the list of protocols supported by a <see cref="WebSocketModule"/>.
/// </summary>
/// <param name="protocols">The protocol names to add to the list.</param>
/// <exception cref="ArgumentNullException">
/// <para><paramref name="protocols"/> is <see langword="null"/>.</para>
/// <para>- or -</para>
/// <para>One or more of the strings in <paramref name="protocols"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// <para>One or more of the strings in <paramref name="protocols"/>
/// contains one or more invalid characters, as defined
/// in <see href="https://tools.ietf.org/html/rfc6455#section-4.3">RFC6455, Section 4.3</see>.</para>
/// <para>- or -</para>
/// <para>One or more of the strings in <paramref name="protocols"/>
/// is already in the list of supported protocols.</para>
/// </exception>
/// <exception cref="InvalidOperationException">The <see cref="WebSocketModule"/> has already been started.</exception>
/// <remarks>
/// <para>This method performs validation checks on all specified <paramref name="protocols"/> before adding them
/// to the list of supported protocols; hence, if an exception is thrown
/// because one of the specified protocols is <see langword="null"/> or contains invalid characters,
/// none of the specified protocol names are added to the list.</para>
/// </remarks>
/// <seealso cref="Validate.Rfc2616Token"/>
/// <seealso cref="AddProtocol"/>
/// <seealso cref="AddProtocols(IEnumerable{string})"/>
Adds one or more WebSocket subprotocols to the list of protocols supported by a .
Adds one or more WebSocket subprotocols to the list of protocols supported by a .
protected void AddProtocols(params string[] protocols)
        {
            protocols = Validate.NotNull(nameof(protocols), protocols);
            if (protocols.Select(p => Validate.Rfc2616Token(nameof(protocols), p, "Protocol name")).Any(protocol => _protocols.Contains(protocol)))
                throw new ArgumentException("Duplicate WebSocket protocol name.", nameof(protocols));
            EnsureConfigurationNotLocked();
            _protocols.AddRange(protocols);
        }
protected void AddProtocols ( params string [ ] protocols ) { protocols = Validate . NotNull ( nameof ( protocols ) , protocols ) ; if ( protocols . Select ( p => Validate . Rfc2616Token ( nameof ( protocols ) , p , " " ) ) . Any ( protocol => _protocols . Contains ( protocol ) ) ) throw new ArgumentException ( " " , nameof ( protocols ) ) ; EnsureConfigurationNotLocked ( ) ; _protocols . AddRange ( protocols ) ; }
Adds one or more WebSocket subprotocols to the list of protocols supported by a .
Adds one or more WebSocket subprotocols to the list of protocols supported by a .
None
One or more of the strings in
contains one or more invalid characters, as defined
in RFC6455, Section 4.3- or -One or more of the strings in
is already in the list of supported protocols.
One or more of the strings in contains one or more invalid characters as defined in RFC6455 Section 4 . 3 - or - One or more of the strings in is already in the list of supported protocols .
The  has already been started.
The has already been started .
protocols
The protocol names to add to the list.
The protocol names to add to the list .
remarks
This method performs validation checks on all specified  before adding them
to the list of supported protocols; hence, if an exception is thrown
because one of the specified protocols is  or contains invalid characters,
none of the specified protocol names are added to the list.
This method performs validation checks on all specified before adding them to the list of supported protocols ; hence if an exception is thrown because one of the specified protocols is or contains invalid characters none of the specified protocol names are added to the list .
seealso
None
seealso
None
seealso
None