[Modify] Throw exception

This commit is contained in:
sta 2017-08-15 15:31:11 +09:00
parent 26c9dbaae0
commit 7afbacd6e0

View File

@ -1086,7 +1086,11 @@ namespace WebSocketSharp.Server
public void SendToAsync (byte[] data, string id, Action<bool> completed)
{
IWebSocketSession session;
if (TryGetSession (id, out session))
if (!TryGetSession (id, out session)) {
var msg = "The session could not be found.";
throw new ArgumentException (msg, "id");
}
session.Context.WebSocket.SendAsync (data, completed);
}