From 8ba734a9a9af4b11dd0f3fdac10d4fa33889f146 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 16 Aug 2017 13:25:11 +0900 Subject: [PATCH] [Modify] Add it --- .../Server/WebSocketSessionManager.cs | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/websocket-sharp/Server/WebSocketSessionManager.cs b/websocket-sharp/Server/WebSocketSessionManager.cs index b18c8a27..0e62599f 100644 --- a/websocket-sharp/Server/WebSocketSessionManager.cs +++ b/websocket-sharp/Server/WebSocketSessionManager.cs @@ -1065,6 +1065,76 @@ namespace WebSocketSharp.Server session.Context.WebSocket.Send (data); } + /// + /// Sends the data from to the client using + /// the specified session. + /// + /// + /// The data is sent as the binary data. + /// + /// + /// A instance from which to read the data to send. + /// + /// + /// An that specifies the number of bytes to send. + /// + /// + /// A that represents the ID of the session. + /// + /// + /// + /// is . + /// + /// + /// -or- + /// + /// + /// is . + /// + /// + /// + /// + /// is an empty string. + /// + /// + /// -or- + /// + /// + /// The session could not be found. + /// + /// + /// -or- + /// + /// + /// cannot be read. + /// + /// + /// -or- + /// + /// + /// is less than 1. + /// + /// + /// -or- + /// + /// + /// No data could be read from . + /// + /// + /// + /// The current state of the WebSocket connection is not Open. + /// + public void SendTo (Stream stream, int length, string id) + { + IWebSocketSession session; + if (!TryGetSession (id, out session)) { + var msg = "The session could not be found."; + throw new ArgumentException (msg, "id"); + } + + session.Context.WebSocket.Send (stream, length); + } + /// /// Sends asynchronously to the client using /// the specified session.