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 enumerates <paramref name="protocols"/> just once; hence, if an exception is thrown
/// because one of the specified protocols is <see langword="null"/> or contains invalid characters,
/// any preceding protocol is added to the list of supported protocols.</para>
/// </remarks>
/// <seealso cref="Validate.Rfc2616Token"/>
/// <seealso cref="AddProtocol"/>
/// <seealso cref="AddProtocols(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(IEnumerable<string> protocols)
        {
            protocols = Validate.NotNull(nameof(protocols), protocols);
            EnsureConfigurationNotLocked();
            foreach (var protocol in protocols.Select(p => Validate.Rfc2616Token(nameof(protocols), p, "Protocol name")))
            {
                if (_protocols.Contains(protocol))
                    throw new ArgumentException("Duplicate WebSocket protocol name.", nameof(protocols));
                _protocols.Add(protocol);
            }
        }
protected void AddProtocols ( IEnumerable < string > protocols ) { protocols = Validate . NotNull ( nameof ( protocols ) , protocols ) ; EnsureConfigurationNotLocked ( ) ; foreach ( var protocol in protocols . Select ( p => Validate . Rfc2616Token ( nameof ( protocols ) , p , " " ) ) ) { if ( _protocols . Contains ( protocol ) ) throw new ArgumentException ( " " , nameof ( protocols ) ) ; _protocols . Add ( protocol ) ; } }
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
IEnumerable<string>
The protocol names to add to the list.
The protocol names to add to the list .
remarks
This method enumerates  just once; hence, if an exception is thrown
because one of the specified protocols is  or contains invalid characters,
any preceding protocol is added to the list of supported protocols.
This method enumerates just once ; hence if an exception is thrown because one of the specified protocols is or contains invalid characters any preceding protocol is added to the list of supported protocols .
seealso
None
seealso
None
seealso
None