diff --git a/websocket-sharp/Server/WebSocketSessionManager.cs b/websocket-sharp/Server/WebSocketSessionManager.cs index a7328a3b..84ca6989 100644 --- a/websocket-sharp/Server/WebSocketSessionManager.cs +++ b/websocket-sharp/Server/WebSocketSessionManager.cs @@ -1024,8 +1024,12 @@ namespace WebSocketSharp.Server public void SendTo (string data, string id) { IWebSocketSession session; - if (TryGetSession (id, out session)) - session.Context.WebSocket.Send (data); + if (!TryGetSession (id, out session)) { + var msg = "The session could not be found."; + throw new ArgumentException (msg, "id"); + } + + session.Context.WebSocket.Send (data); } ///