diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs index 471e287b..9f7894bf 100644 --- a/websocket-sharp/Server/WebSocketBehavior.cs +++ b/websocket-sharp/Server/WebSocketBehavior.cs @@ -535,6 +535,54 @@ namespace WebSocketSharp.Server _websocket.Send (data); } + /// + /// Sends the data from the specified stream to a client using + /// the WebSocket connection. + /// + /// + /// + /// A instance from which to read the data to send. + /// + /// + /// The data is sent as the binary data. + /// + /// + /// + /// An that specifies the number of bytes to send. + /// + /// + /// The current state of the connection is not Open. + /// + /// + /// is . + /// + /// + /// + /// cannot be read. + /// + /// + /// -or- + /// + /// + /// is less than 1. + /// + /// + /// -or- + /// + /// + /// No data could be read from . + /// + /// + protected void Send (Stream stream, int length) + { + if (_websocket == null) { + var msg = "The current state of the connection is not Open."; + throw new InvalidOperationException (msg); + } + + _websocket.Send (stream, length); + } + /// /// Sends the specified data to a client asynchronously using /// the WebSocket connection.