|
|
|
@ -887,17 +887,22 @@ namespace WebSocketSharp.Server
|
|
|
|
/// The type of the behavior of the service to add. The TBehavior must inherit
|
|
|
|
/// The type of the behavior of the service to add. The TBehavior must inherit
|
|
|
|
/// the <see cref="WebSocketBehavior"/> class.
|
|
|
|
/// the <see cref="WebSocketBehavior"/> class.
|
|
|
|
/// </typeparam>
|
|
|
|
/// </typeparam>
|
|
|
|
public void AddWebSocketService<TBehavior> (string path, Func<TBehavior> initializer)
|
|
|
|
public void AddWebSocketService<TBehavior> (
|
|
|
|
|
|
|
|
string path, Func<TBehavior> initializer
|
|
|
|
|
|
|
|
)
|
|
|
|
where TBehavior : WebSocketBehavior
|
|
|
|
where TBehavior : WebSocketBehavior
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var msg = path.CheckIfValidServicePath () ??
|
|
|
|
string msg;
|
|
|
|
(initializer == null ? "'initializer' is null." : null);
|
|
|
|
if (!checkServicePath (path, out msg)) {
|
|
|
|
|
|
|
|
|
|
|
|
if (msg != null) {
|
|
|
|
|
|
|
|
_logger.Error (msg);
|
|
|
|
_logger.Error (msg);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (initializer == null) {
|
|
|
|
|
|
|
|
_logger.Error ("'initializer' is null.");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_services.Add<TBehavior> (path, initializer);
|
|
|
|
_services.Add<TBehavior> (path, initializer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|