[Modify] Add it

This commit is contained in:
sta 2017-03-08 16:29:49 +09:00
parent af04ac1240
commit 669f923c96

View File

@ -1116,6 +1116,63 @@ namespace WebSocketSharp.Server
_services.AddService<TBehaviorWithNew> (path, null);
}
/// <summary>
/// Adds a WebSocket service with the specified behavior,
/// <paramref name="path"/>, and <paramref name="initializer"/>.
/// </summary>
/// <remarks>
/// <paramref name="path"/> is converted to a URL-decoded string and
/// / is trimmed from the end of the converted string if any.
/// </remarks>
/// <param name="path">
/// A <see cref="string"/> that represents an absolute path to
/// the service to add.
/// </param>
/// <param name="initializer">
/// An <c>Action&lt;TBehaviorWithNew&gt;</c> delegate that invokes
/// the method used to initialize a new session instance for
/// the service or <see langword="null"/> if not needed.
/// </param>
/// <typeparam name="TBehaviorWithNew">
/// The type of the behavior for the service. It must inherit
/// the <see cref="WebSocketBehavior"/> class and it must have
/// a public parameterless constructor.
/// </typeparam>
/// <exception cref="ArgumentNullException">
/// <paramref name="path"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="ArgumentException">
/// <para>
/// <paramref name="path"/> is empty.
/// </para>
/// <para>
/// -or-
/// </para>
/// <para>
/// <paramref name="path"/> is not an absolute path.
/// </para>
/// <para>
/// -or-
/// </para>
/// <para>
/// <paramref name="path"/> includes either or both
/// query and fragment components.
/// </para>
/// <para>
/// -or-
/// </para>
/// <para>
/// <paramref name="path"/> is already in use.
/// </para>
/// </exception>
public void AddWebSocketService<TBehaviorWithNew> (
string path, Action<TBehaviorWithNew> initializer
)
where TBehaviorWithNew : WebSocketBehavior, new ()
{
_services.AddService<TBehaviorWithNew> (path, initializer);
}
/// <summary>
/// Removes a WebSocket service with the specified <paramref name="path"/>.
/// </summary>