diff --git a/websocket-sharp/Server/WebSocketServiceHostManager.cs b/websocket-sharp/Server/WebSocketServiceHostManager.cs
index ced1a652..8c21eac6 100644
--- a/websocket-sharp/Server/WebSocketServiceHostManager.cs
+++ b/websocket-sharp/Server/WebSocketServiceHostManager.cs
@@ -37,7 +37,7 @@ using WebSocketSharp.Net;
namespace WebSocketSharp.Server
{
///
- /// Manages the WebSocket services provided by the and
+ /// Manages the WebSocket services provided by the or
/// .
///
public class WebSocketServiceHostManager
@@ -73,15 +73,15 @@ namespace WebSocketSharp.Server
#region Public Properties
///
- /// Gets the number of the WebSocket services provided by the WebSocket server.
+ /// Gets the number of the WebSocket services provided by the server.
///
///
- /// An that contains the number of the WebSocket services.
+ /// An that represents the number of the WebSocket services
+ /// provided by the server.
///
public int Count {
get {
- lock (_sync)
- {
+ lock (_sync) {
return _serviceHosts.Count;
}
}
@@ -91,11 +91,13 @@ namespace WebSocketSharp.Server
/// Gets a WebSocket service host with the specified .
///
///
- /// A instance that represents the service host
- /// if the service is successfully found; otherwise, .
+ /// A instance that represents the
+ /// WebSocket service host if it's successfully found; otherwise,
+ /// .
///
///
- /// A that contains an absolute path to the service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
public WebSocketServiceHost this [string servicePath] {
get {
@@ -107,12 +109,12 @@ namespace WebSocketSharp.Server
}
///
- /// Gets a value indicating whether the manager cleans up periodically the every inactive session
- /// to the WebSocket services provided by the WebSocket server.
+ /// Gets a value indicating whether the manager cleans up periodically the
+ /// every inactive session to the WebSocket services provided by the server.
///
///
- /// true if the manager cleans up periodically the every inactive session to the WebSocket
- /// services; otherwise, false.
+ /// true if the manager cleans up periodically the every inactive
+ /// session to the WebSocket services; otherwise, false.
///
public bool KeepClean {
get {
@@ -120,8 +122,7 @@ namespace WebSocketSharp.Server
}
internal set {
- lock (_sync)
- {
+ lock (_sync) {
if (!(value ^ _keepClean))
return;
@@ -133,48 +134,47 @@ namespace WebSocketSharp.Server
}
///
- /// Gets the collection of the WebSocket service hosts managed by the WebSocket server.
+ /// Gets the collection of the WebSocket service hosts managed by the server.
///
///
- /// An IEnumerable<WebSocketServiceHost> that contains the collection of the WebSocket
- /// service hosts.
+ /// An IEnumerable<WebSocketServiceHost> that contains the collection of
+ /// the WebSocket service hosts.
///
public IEnumerable ServiceHosts {
get {
- lock (_sync)
- {
+ lock (_sync) {
return _serviceHosts.Values.ToList ();
}
}
}
///
- /// Gets the collection of every path to the WebSocket services provided by the WebSocket server.
+ /// Gets the collection of every path to the WebSocket services provided by
+ /// the server.
///
///
- /// An IEnumerable<string> that contains the collection of every path to the WebSocket services.
+ /// An IEnumerable<string> that contains the collection of every path to
+ /// the WebSocket services.
///
public IEnumerable ServicePaths {
get {
- lock (_sync)
- {
+ lock (_sync) {
return _serviceHosts.Keys.ToList ();
}
}
}
///
- /// Gets the number of the sessions to the every WebSocket service
- /// provided by the WebSocket server.
+ /// Gets the number of the sessions to the every WebSocket service provided by
+ /// the server.
///
///
- /// An that contains the session count of the WebSocket server.
+ /// An that represents the session count of the server.
///
public int SessionCount {
get {
var count = 0;
- foreach (var host in ServiceHosts)
- {
+ foreach (var host in ServiceHosts) {
if (_state != ServerState.START)
break;
@@ -193,8 +193,7 @@ namespace WebSocketSharp.Server
{
var cache = new Dictionary ();
try {
- foreach (var host in ServiceHosts)
- {
+ foreach (var host in ServiceHosts) {
if (_state != ServerState.START)
break;
@@ -216,8 +215,7 @@ namespace WebSocketSharp.Server
{
var cache = new Dictionary ();
try {
- foreach (var host in ServiceHosts)
- {
+ foreach (var host in ServiceHosts) {
if (_state != ServerState.START)
break;
@@ -240,33 +238,26 @@ namespace WebSocketSharp.Server
private void broadcastAsync (Opcode opcode, byte [] data, Action completed)
{
- WaitCallback callback = state =>
- {
- broadcast (opcode, data, completed);
- };
-
- ThreadPool.QueueUserWorkItem (callback);
+ ThreadPool.QueueUserWorkItem (
+ state => broadcast (opcode, data, completed));
}
private void broadcastAsync (Opcode opcode, Stream stream, Action completed)
{
- WaitCallback callback = state =>
- {
- broadcast (opcode, stream, completed);
- };
-
- ThreadPool.QueueUserWorkItem (callback);
+ ThreadPool.QueueUserWorkItem (
+ state => broadcast (opcode, stream, completed));
}
- private Dictionary> broadping (byte [] frameAsBytes, int timeOut)
+ private Dictionary> broadping (
+ byte [] frameAsBytes, int timeOut)
{
var result = new Dictionary> ();
- foreach (var host in ServiceHosts)
- {
+ foreach (var host in ServiceHosts) {
if (_state != ServerState.START)
break;
- result.Add (host.ServicePath, host.Sessions.Broadping (frameAsBytes, timeOut));
+ result.Add (
+ host.ServicePath, host.Sessions.Broadping (frameAsBytes, timeOut));
}
return result;
@@ -278,11 +269,9 @@ namespace WebSocketSharp.Server
internal void Add (string servicePath, WebSocketServiceHost serviceHost)
{
- lock (_sync)
- {
+ lock (_sync) {
WebSocketServiceHost host;
- if (_serviceHosts.TryGetValue (servicePath, out host))
- {
+ if (_serviceHosts.TryGetValue (servicePath, out host)) {
_logger.Error (
"A WebSocket service with the specified path already exists.\npath: " + servicePath);
return;
@@ -298,11 +287,10 @@ namespace WebSocketSharp.Server
internal bool Remove (string servicePath)
{
servicePath = HttpUtility.UrlDecode (servicePath).TrimEndSlash ();
+
WebSocketServiceHost host;
- lock (_sync)
- {
- if (!_serviceHosts.TryGetValue (servicePath, out host))
- {
+ lock (_sync) {
+ if (!_serviceHosts.TryGetValue (servicePath, out host)) {
_logger.Error (
"A WebSocket service with the specified path not found.\npath: " + servicePath);
return false;
@@ -312,15 +300,15 @@ namespace WebSocketSharp.Server
}
if (host.Sessions.State == ServerState.START)
- host.Sessions.Stop (((ushort) CloseStatusCode.AWAY).ToByteArrayInternally (ByteOrder.BIG), true);
+ host.Sessions.Stop (
+ ((ushort) CloseStatusCode.AWAY).ToByteArrayInternally (ByteOrder.BIG), true);
return true;
}
internal void Start ()
{
- lock (_sync)
- {
+ lock (_sync) {
foreach (var host in _serviceHosts.Values)
host.Sessions.Start ();
@@ -330,15 +318,15 @@ namespace WebSocketSharp.Server
internal void Stop (byte [] data, bool send)
{
- lock (_sync)
- {
+ lock (_sync) {
_state = ServerState.SHUTDOWN;
var payload = new PayloadData (data);
var args = new CloseEventArgs (payload);
- var frameAsBytes = send
- ? WsFrame.CreateCloseFrame (Mask.UNMASK, payload).ToByteArray ()
- : null;
+ var frameAsBytes =
+ send
+ ? WsFrame.CreateCloseFrame (Mask.UNMASK, payload).ToByteArray ()
+ : null;
foreach (var host in _serviceHosts.Values)
host.Sessions.Stop (args, frameAsBytes);
@@ -349,17 +337,19 @@ namespace WebSocketSharp.Server
}
}
- internal bool TryGetServiceHostInternally (string servicePath, out WebSocketServiceHost serviceHost)
+ internal bool TryGetServiceHostInternally (
+ string servicePath, out WebSocketServiceHost serviceHost)
{
servicePath = HttpUtility.UrlDecode (servicePath).TrimEndSlash ();
+
bool result;
- lock (_sync)
- {
+ lock (_sync) {
result = _serviceHosts.TryGetValue (servicePath, out serviceHost);
}
if (!result)
- _logger.Error ("A WebSocket service with the specified path not found.\npath: " + servicePath);
+ _logger.Error (
+ "A WebSocket service with the specified path not found.\npath: " + servicePath);
return result;
}
@@ -369,54 +359,66 @@ namespace WebSocketSharp.Server
#region Public Methods
///
- /// Broadcasts a binary to all clients of the WebSocket services
- /// provided by a WebSocket server.
+ /// Broadcasts a binary to all clients of the
+ /// WebSocket services provided by the server.
///
- ///
- /// This method does not wait for the broadcast to be complete.
- ///
///
- /// An array of that contains a binary data to broadcast.
+ /// An array of that contains the binary data to broadcast.
///
public void Broadcast (byte [] data)
{
- Broadcast (data, null);
+ var msg = _state.CheckIfStarted () ?? data.CheckIfValidSendData ();
+ if (msg != null) {
+ _logger.Error (msg);
+ return;
+ }
+
+ if (data.LongLength <= WebSocket.FragmentLength)
+ broadcast (Opcode.BINARY, data, null);
+ else
+ broadcast (Opcode.BINARY, new MemoryStream (data), null);
}
///
- /// Broadcasts a text to all clients of the WebSocket services
- /// provided by a WebSocket server.
+ /// Broadcasts a text to all clients of the WebSocket
+ /// services provided by the server.
///
- ///
- /// This method does not wait for the broadcast to be complete.
- ///
///
- /// A that contains a text data to broadcast.
+ /// A that represents the text data to broadcast.
///
public void Broadcast (string data)
{
- Broadcast (data, null);
+ var msg = _state.CheckIfStarted () ?? data.CheckIfValidSendData ();
+ if (msg != null) {
+ _logger.Error (msg);
+ return;
+ }
+
+ var rawData = Encoding.UTF8.GetBytes (data);
+ if (rawData.LongLength <= WebSocket.FragmentLength)
+ broadcast (Opcode.TEXT, rawData, null);
+ else
+ broadcast (Opcode.TEXT, new MemoryStream (rawData), null);
}
///
- /// Broadcasts a binary to all clients of the WebSocket services
- /// provided by a WebSocket server.
+ /// Broadcasts a binary asynchronously to all clients
+ /// of the WebSocket services provided by the server.
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// An array of that contains a binary data to broadcast.
+ /// An array of that contains the binary data to broadcast.
///
///
/// A delegate that references the method(s) called when
/// the broadcast is complete.
///
- public void Broadcast (byte [] data, Action completed)
+ public void BroadcastAsync (byte [] data, Action completed)
{
var msg = _state.CheckIfStarted () ?? data.CheckIfValidSendData ();
- if (msg != null)
- {
+ if (msg != null) {
_logger.Error (msg);
return;
}
@@ -428,24 +430,23 @@ namespace WebSocketSharp.Server
}
///
- /// Broadcasts a text to all clients of the WebSocket services
- /// provided by a WebSocket server.
+ /// Broadcasts a text asynchronously to all clients of
+ /// the WebSocket services provided by the server.
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// A that contains a text data to broadcast.
+ /// A that represents the text data to broadcast.
///
///
/// A delegate that references the method(s) called when
/// the broadcast is complete.
///
- public void Broadcast (string data, Action completed)
+ public void BroadcastAsync (string data, Action completed)
{
var msg = _state.CheckIfStarted () ?? data.CheckIfValidSendData ();
- if (msg != null)
- {
+ if (msg != null) {
_logger.Error (msg);
return;
}
@@ -458,92 +459,74 @@ namespace WebSocketSharp.Server
}
///
- /// Broadcasts a binary data from the specified to all clients
- /// of the WebSocket services provided by a WebSocket server.
+ /// Broadcasts a binary data from the specified
+ /// asynchronously to all clients of the WebSocket services provided by the
+ /// server.
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// A object from which contains a binary data to broadcast.
+ /// A object from which contains the binary data to
+ /// broadcast.
///
///
- /// An that contains the number of bytes to broadcast.
- ///
- public void Broadcast (Stream stream, int length)
- {
- Broadcast (stream, length, null);
- }
-
- ///
- /// Broadcasts a binary data from the specified to all clients
- /// of the WebSocket services provided by a WebSocket server.
- ///
- ///
- /// This method does not wait for the broadcast to be complete.
- ///
- ///
- /// A object from which contains a binary data to broadcast.
- ///
- ///
- /// An that contains the number of bytes to broadcast.
+ /// An that represents the number of bytes to broadcast.
///
///
/// A delegate that references the method(s) called when
/// the broadcast is complete.
///
- public void Broadcast (Stream stream, int length, Action completed)
+ public void BroadcastAsync (Stream stream, int length, Action completed)
{
var msg = _state.CheckIfStarted () ??
stream.CheckIfCanRead () ??
(length < 1 ? "'length' must be greater than 0." : null);
- if (msg != null)
- {
+ if (msg != null) {
_logger.Error (msg);
return;
}
stream.ReadBytesAsync (
length,
- data =>
- {
+ data => {
var len = data.Length;
- if (len == 0)
- {
+ if (len == 0) {
_logger.Error ("A data cannot be read from 'stream'.");
return;
}
if (len < length)
- _logger.Warn (String.Format (
- "A data with 'length' cannot be read from 'stream'.\nexpected: {0} actual: {1}",
- length,
- len));
+ _logger.Warn (
+ String.Format (
+ "A data with 'length' cannot be read from 'stream'.\nexpected: {0} actual: {1}",
+ length,
+ len));
if (len <= WebSocket.FragmentLength)
broadcast (Opcode.BINARY, data, completed);
else
broadcast (Opcode.BINARY, new MemoryStream (data), completed);
},
- ex =>
- {
+ ex => {
_logger.Fatal (ex.ToString ());
});
}
///
- /// Broadcasts a binary to all clients of a WebSocket service
- /// with the specified .
+ /// Broadcasts a binary to all clients of the
+ /// WebSocket service with the specified .
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// An array of that contains a binary data to broadcast.
+ /// An array of that contains the binary data to broadcast.
///
public void BroadcastTo (string servicePath, byte [] data)
{
@@ -551,17 +534,18 @@ namespace WebSocketSharp.Server
}
///
- /// Broadcasts a text to all clients of a WebSocket service
- /// with the specified .
+ /// Broadcasts a text to all clients of the WebSocket
+ /// service with the specified .
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a text data to broadcast.
+ /// A that represents the text data to broadcast.
///
public void BroadcastTo (string servicePath, string data)
{
@@ -569,17 +553,18 @@ namespace WebSocketSharp.Server
}
///
- /// Broadcasts a binary to all clients of a WebSocket service
- /// with the specified .
+ /// Broadcasts a binary to all clients of the
+ /// WebSocket service with the specified .
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// An array of that contains a binary data to broadcast.
+ /// An array of that contains the binary data to broadcast.
///
///
/// A delegate that references the method(s) called when
@@ -593,17 +578,18 @@ namespace WebSocketSharp.Server
}
///
- /// Broadcasts a text to all clients of a WebSocket service
- /// with the specified .
+ /// Broadcasts a text to all clients of the WebSocket
+ /// service with the specified .
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a text data to broadcast.
+ /// A that represents the text data to broadcast.
///
///
/// A delegate that references the method(s) called when
@@ -617,41 +603,22 @@ namespace WebSocketSharp.Server
}
///
- /// Broadcasts a binary data from the specified to all clients
- /// of a WebSocket service with the specified .
+ /// Broadcasts a binary data from the specified to all
+ /// clients of the WebSocket service with the specified .
///
///
- /// This method does not wait for the broadcast to be complete.
+ /// This method doesn't wait for the broadcast to be complete.
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A object from which contains a binary data to broadcast.
+ /// A object from which contains the binary data to
+ /// broadcast.
///
///
- /// An that contains the number of bytes to broadcast.
- ///
- public void BroadcastTo (string servicePath, Stream stream, int length)
- {
- BroadcastTo (servicePath, stream, length, null);
- }
-
- ///
- /// Broadcasts a binary data from the specified to all clients
- /// of a WebSocket service with the specified .
- ///
- ///
- /// This method does not wait for the broadcast to be complete.
- ///
- ///
- /// A that contains an absolute path to the WebSocket service to find.
- ///
- ///
- /// A object from which contains a binary data to broadcast.
- ///
- ///
- /// An that contains the number of bytes to broadcast.
+ /// An that represents the number of bytes to broadcast.
///
///
/// A delegate that references the method(s) called when
@@ -666,18 +633,19 @@ namespace WebSocketSharp.Server
}
///
- /// Sends Pings to all clients of the WebSocket services provided by a WebSocket server.
+ /// Sends Pings to all clients of the WebSocket services provided by the
+ /// server.
///
///
- /// A Dictionary<string, Dictionary<string, bool>> that contains the collection of
- /// service paths and pairs of session ID and value indicating whether each WebSocket service
- /// received a Pong from each client in a time.
+ /// A Dictionary<string, Dictionary<string, bool>> that contains
+ /// the collection of service paths and pairs of session ID and value
+ /// indicating whether each WebSocket service received a Pong from each client
+ /// in a time.
///
public Dictionary> Broadping ()
{
var msg = _state.CheckIfStarted ();
- if (msg != null)
- {
+ if (msg != null) {
_logger.Error (msg);
return null;
}
@@ -686,17 +654,17 @@ namespace WebSocketSharp.Server
}
///
- /// Sends Pings with the specified to all clients of the WebSocket
- /// services provided by a WebSocket server.
+ /// Sends Pings with the specified to all clients
+ /// of the WebSocket services provided by the server.
///
///
- /// A Dictionary<string, Dictionary<string, bool>> that contains the collection of
- /// service paths and pairs of session ID and value indicating whether each WebSocket service
- /// received a Pong from each client in a time.
- /// If is invalid, returns .
+ /// A Dictionary<string, Dictionary<string, bool>> that contains
+ /// the collection of service paths and pairs of session ID and value
+ /// indicating whether each WebSocket service received a Pong from each client
+ /// in a time. If is invalid, returns .
///
///
- /// A that contains a message to broadcast.
+ /// A that represents the message to broadcast.
///
public Dictionary> Broadping (string message)
{
@@ -707,26 +675,28 @@ namespace WebSocketSharp.Server
var msg = _state.CheckIfStarted () ??
(data = Encoding.UTF8.GetBytes (message)).CheckIfValidPingData ();
- if (msg != null)
- {
+ if (msg != null) {
_logger.Error (msg);
return null;
}
- return broadping (WsFrame.CreatePingFrame (Mask.UNMASK, data).ToByteArray (), 1000);
+ return broadping (
+ WsFrame.CreatePingFrame (Mask.UNMASK, data).ToByteArray (), 1000);
}
///
- /// Sends Pings to all clients of a WebSocket service with
- /// the specified .
+ /// Sends Pings to all clients of the WebSocket service with the specified
+ /// .
///
///
- /// A Dictionary<string, bool> that contains the collection of pairs of session ID and
- /// value indicating whether the WebSocket service received a Pong from each client in a time.
- /// If the WebSocket service not found, returns .
+ /// A Dictionary<string, bool> that contains the collection of pairs of
+ /// session ID and value indicating whether the WebSocket service received a
+ /// Pong from each client in a time. If the WebSocket service not found,
+ /// returns .
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
public Dictionary BroadpingTo (string servicePath)
{
@@ -738,20 +708,23 @@ namespace WebSocketSharp.Server
///
/// Sends Pings with the specified to all clients
- /// of a WebSocket service with the specified .
+ /// of the WebSocket service with the specified .
///
///
- /// A Dictionary<string, bool> that contains the collection of pairs of session ID and
- /// value indicating whether the WebSocket service received a Pong from each client in a time.
- /// If the WebSocket service not found, returns .
+ /// A Dictionary<string, bool> that contains the collection of pairs of
+ /// session ID and value indicating whether the WebSocket service received a
+ /// Pong from each client in a time. If the WebSocket service not found,
+ /// returns .
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a message to send.
+ /// A that represents the message to send.
///
- public Dictionary BroadpingTo (string servicePath, string message)
+ public Dictionary BroadpingTo (
+ string servicePath, string message)
{
WebSocketServiceHost host;
return TryGetServiceHost (servicePath, out host)
@@ -764,10 +737,11 @@ namespace WebSocketSharp.Server
/// .
///
///
- /// A that contains an absolute path to a WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a session ID to find.
+ /// A that represents the session ID to find.
///
public void CloseSession (string servicePath, string id)
{
@@ -777,22 +751,24 @@ namespace WebSocketSharp.Server
}
///
- /// Closes the session with the specified , ,
- /// and .
+ /// Closes the session with the specified ,
+ /// , and .
///
///
- /// A that contains an absolute path to a WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a session ID to find.
+ /// A that represents the session ID to find.
///
///
- /// A that contains a status code indicating the reason for closure.
+ /// A that indicates the status code for closure.
///
///
- /// A that contains the reason for closure.
+ /// A that represents the reason for closure.
///
- public void CloseSession (string servicePath, string id, ushort code, string reason)
+ public void CloseSession (
+ string servicePath, string id, ushort code, string reason)
{
WebSocketServiceHost host;
if (TryGetServiceHost (servicePath, out host))
@@ -800,22 +776,25 @@ namespace WebSocketSharp.Server
}
///
- /// Closes the session with the specified , ,
- /// and .
+ /// Closes the session with the specified ,
+ /// , and .
///
///
- /// A that contains an absolute path to a WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a session ID to find.
+ /// A that represents the session ID to find.
///
///
- /// One of the values that indicate the status codes for closure.
+ /// One of the values that indicate the status
+ /// codes for closure.
///
///
- /// A that contains the reason for closure.
+ /// A that represents the reason for closure.
///
- public void CloseSession (string servicePath, string id, CloseStatusCode code, string reason)
+ public void CloseSession (
+ string servicePath, string id, CloseStatusCode code, string reason)
{
WebSocketServiceHost host;
if (TryGetServiceHost (servicePath, out host))
@@ -823,48 +802,53 @@ namespace WebSocketSharp.Server
}
///
- /// Sends a Ping to the client associated with the specified
- /// and .
+ /// Sends a Ping to the client associated with the specified
+ /// and .
///
///
- /// true if the WebSocket service with receives
- /// a Pong from the client in a time; otherwise, false.
+ /// true if the WebSocket service with
+ /// receives a Pong from the client in a time; otherwise, false.
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a session ID that represents the destination
- /// for the Ping.
+ /// A that represents the session ID that represents the
+ /// destination for the Ping.
///
public bool PingTo (string servicePath, string id)
{
WebSocketServiceHost host;
- return TryGetServiceHost (servicePath, out host) && host.Sessions.PingTo (id);
+ return TryGetServiceHost (servicePath, out host) &&
+ host.Sessions.PingTo (id);
}
///
- /// Sends a Ping with the specified to the client associated
- /// with the specified and .
+ /// Sends a Ping with the specified to the client
+ /// associated with the specified and
+ /// .
///
///
- /// true if the WebSocket service with receives
- /// a Pong from the client in a time; otherwise, false.
+ /// true if the WebSocket service with
+ /// receives a Pong from the client in a time; otherwise, false.
///
///
- /// A that contains an absolute path to the WebSocket service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// A that contains a session ID that represents the destination
- /// for the Ping.
+ /// A that represents the session ID that represents the
+ /// destination for the Ping.
///
///
- /// A that contains a message to send.
+ /// A that represents the message to send.
///
public bool PingTo (string servicePath, string id, string message)
{
WebSocketServiceHost host;
- return TryGetServiceHost (servicePath, out host) && host.Sessions.PingTo (id, message);
+ return TryGetServiceHost (servicePath, out host) &&
+ host.Sessions.PingTo (id, message);
}
///
@@ -1014,24 +998,27 @@ namespace WebSocketSharp.Server
}
///
- /// Tries to get a WebSocket service host with the specified .
+ /// Tries to get a WebSocket service host with the specified
+ /// .
///
///
- /// true if the service is successfully found; otherwise, false.
+ /// true if the WebSocket service host is successfully found;
+ /// otherwise, false.
///
///
- /// A that contains an absolute path to the service to find.
+ /// A that represents the absolute path to the WebSocket
+ /// service to find.
///
///
- /// When this method returns, a instance that represents
- /// the service host if the service is successfully found; otherwise, .
- /// This parameter is passed uninitialized.
+ /// When this method returns, a instance
+ /// that represents the WebSocket service host if it's successfully found;
+ /// otherwise, . This parameter is passed uninitialized.
///
- public bool TryGetServiceHost (string servicePath, out WebSocketServiceHost serviceHost)
+ public bool TryGetServiceHost (
+ string servicePath, out WebSocketServiceHost serviceHost)
{
var msg = _state.CheckIfStarted () ?? servicePath.CheckIfValidServicePath ();
- if (msg != null)
- {
+ if (msg != null) {
_logger.Error (msg);
serviceHost = null;