diff --git a/websocket-sharp/Server/WebSocketSessionManager.cs b/websocket-sharp/Server/WebSocketSessionManager.cs
index 7c1acc92..8252ec85 100644
--- a/websocket-sharp/Server/WebSocketSessionManager.cs
+++ b/websocket-sharp/Server/WebSocketSessionManager.cs
@@ -467,6 +467,79 @@ namespace WebSocketSharp.Server
broadcast (Opcode.Text, new MemoryStream (bytes), null);
}
+ ///
+ /// Sends the specified of data from
+ /// the specified to every client in
+ /// the WebSocket service.
+ ///
+ ///
+ /// A from which to read the binary data to send.
+ ///
+ ///
+ /// An that specifies the number of bytes to send.
+ ///
+ ///
+ /// The current state of the manager is not Start.
+ ///
+ ///
+ /// is .
+ ///
+ ///
+ ///
+ /// cannot be read.
+ ///
+ ///
+ /// -or-
+ ///
+ ///
+ /// is less than 1.
+ ///
+ ///
+ /// -or-
+ ///
+ ///
+ /// No data could be read from .
+ ///
+ ///
+ public void Broadcast (Stream stream, int length)
+ {
+ if (_state != ServerState.Start) {
+ var msg = "The current state of the manager is not Start.";
+ throw new InvalidOperationException (msg);
+ }
+
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+
+ if (!stream.CanRead)
+ throw new ArgumentException ("It cannot be read.", "stream");
+
+ if (length < 1)
+ throw new ArgumentException ("Less than 1.", "length");
+
+ var bytes = stream.ReadBytes (length);
+
+ var len = bytes.Length;
+ if (len == 0) {
+ var msg = "No data could be read from it.";
+ throw new ArgumentException (msg, "stream");
+ }
+
+ if (len < length) {
+ _logger.Warn (
+ String.Format (
+ "Only {0} byte(s) of data could be read from the specified stream.",
+ len
+ )
+ );
+ }
+
+ if (len <= WebSocket.FragmentLength)
+ broadcast (Opcode.Binary, bytes, null);
+ else
+ broadcast (Opcode.Binary, new MemoryStream (bytes), null);
+ }
+
///
/// Sends the specified asynchronously to
/// every client in the WebSocket service.