diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs
index 2e828b2a..a6a12a64 100644
--- a/websocket-sharp/Server/WebSocketServer.cs
+++ b/websocket-sharp/Server/WebSocketServer.cs
@@ -80,8 +80,8 @@ namespace WebSocketSharp.Server
/// Initializes a new instance of the class.
///
///
- /// An instance initialized by this constructor listens for the incoming
- /// connection requests on port 80.
+ /// An instance initialized by this constructor listens for the incoming connection requests on
+ /// port 80.
///
public WebSocketServer ()
: this (80)
@@ -89,17 +89,16 @@ namespace WebSocketSharp.Server
}
///
- /// Initializes a new instance of the class
- /// with the specified .
+ /// Initializes a new instance of the class with the specified
+ /// .
///
///
///
- /// An instance initialized by this constructor listens for the incoming
- /// connection requests on .
+ /// An instance initialized by this constructor listens for the incoming connection requests
+ /// on .
///
///
- /// And if is 443, that instance provides a secure
- /// connection.
+ /// And if is 443, that instance provides a secure connection.
///
///
///
@@ -114,18 +113,18 @@ namespace WebSocketSharp.Server
}
///
- /// Initializes a new instance of the class
- /// with the specified WebSocket URL.
+ /// Initializes a new instance of the class with the specified
+ /// WebSocket URL.
///
///
///
- /// An instance initialized by this constructor listens for the incoming
- /// connection requests on the port (if any) in .
+ /// An instance initialized by this constructor listens for the incoming connection requests
+ /// on the port (if any) in .
///
///
- /// So if is without a port, either port 80 or 443
- /// is used on which to listen. It's determined by the scheme (ws or wss)
- /// in . (port 80 if the scheme is ws.)
+ /// So if is without a port, either port 80 or 443 is used on which to
+ /// listen. It's determined by the scheme (ws or wss) in . (port 80 if
+ /// the scheme is ws.)
///
///
///
@@ -150,8 +149,7 @@ namespace WebSocketSharp.Server
_address = host.ToIPAddress ();
if (_address == null || !_address.IsLocal ())
throw new ArgumentException (
- String.Format (
- "The host part must be the local host name: {0}", host), "url");
+ String.Format ("The host part must be the local host name: {0}", host), "url");
_port = _uri.Port;
_secure = _uri.Scheme == "wss" ? true : false;
@@ -160,19 +158,19 @@ namespace WebSocketSharp.Server
}
///
- /// Initializes a new instance of the class
- /// with the specified and .
+ /// Initializes a new instance of the class with the specified
+ /// and .
///
///
- /// An instance initialized by this constructor listens for the incoming
- /// connection requests on .
+ /// An instance initialized by this constructor listens for the incoming connection requests on
+ /// .
///
///
/// An that represents the port number on which to listen.
///
///
- /// A that indicates providing a secure connection or not.
- /// (true indicates providing a secure connection.)
+ /// A that indicates providing a secure connection or not. (true
+ /// indicates providing a secure connection.)
///
///
/// isn't between 1 and 65535.
@@ -186,22 +184,20 @@ namespace WebSocketSharp.Server
}
///
- /// Initializes a new instance of the class
- /// with the specified and .
+ /// Initializes a new instance of the class with the specified
+ /// and .
///
///
///
- /// An instance initialized by this constructor listens for the incoming
- /// connection requests on .
+ /// An instance initialized by this constructor listens for the incoming connection requests
+ /// on .
///
///
- /// And if is 443, that instance provides a secure
- /// connection.
+ /// And if is 443, that instance provides a secure connection.
///
///
///
- /// A that represents the local IP address
- /// of the server.
+ /// A that represents the local IP address of the server.
///
///
/// An that represents the port number on which to listen.
@@ -221,24 +217,22 @@ namespace WebSocketSharp.Server
}
///
- /// Initializes a new instance of the class
- /// with the specified , ,
- /// and .
+ /// Initializes a new instance of the class with the specified
+ /// , , and .
///
///
- /// An instance initialized by this constructor listens for the incoming
- /// connection requests on .
+ /// An instance initialized by this constructor listens for the incoming connection requests on
+ /// .
///
///
- /// A that represents the local IP address
- /// of the server.
+ /// A that represents the local IP address of the server.
///
///
/// An that represents the port number on which to listen.
///
///
- /// A that indicates providing a secure connection or not.
- /// (true indicates providing a secure connection.)
+ /// A that indicates providing a secure connection or not. (true
+ /// indicates providing a secure connection.)
///
///
/// is .
@@ -254,25 +248,21 @@ namespace WebSocketSharp.Server
/// -or-
///
///
- /// Pair of and is
- /// invalid.
+ /// Pair of and is invalid.
///
///
public WebSocketServer (System.Net.IPAddress address, int port, bool secure)
{
if (!address.IsLocal ())
throw new ArgumentException (
- String.Format (
- "Must be the local IP address: {0}", address), "address");
+ String.Format ("Must be the local IP address: {0}", address), "address");
if (!port.IsPortNumber ())
- throw new ArgumentOutOfRangeException (
- "port", "Must be between 1 and 65535: " + port);
+ throw new ArgumentOutOfRangeException ("port", "Must be between 1 and 65535: " + port);
if ((port == 80 && secure) || (port == 443 && !secure))
throw new ArgumentException (
- String.Format (
- "Invalid pair of 'port' and 'secure': {0}, {1}", port, secure));
+ String.Format ("Invalid pair of 'port' and 'secure': {0}, {1}", port, secure));
_address = address;
_port = port;
@@ -290,8 +280,7 @@ namespace WebSocketSharp.Server
/// Gets the local IP address of the server.
///
///
- /// A that represents the local IP
- /// address of the server.
+ /// A that represents the local IP address of the server.
///
public System.Net.IPAddress Address {
get {
@@ -303,9 +292,9 @@ namespace WebSocketSharp.Server
/// Gets or sets the scheme used to authenticate the clients.
///
///
- /// One of the enum
- /// values, indicates the scheme used to authenticate the clients. The default
- /// value is .
+ /// One of the enum values, indicates
+ /// the scheme used to authenticate the clients.
+ /// The default value is .
///
public AuthenticationSchemes AuthenticationSchemes {
get {
@@ -321,8 +310,7 @@ namespace WebSocketSharp.Server
}
///
- /// Gets or sets the certificate used to authenticate the server on the
- /// secure connection.
+ /// Gets or sets the certificate used to authenticate the server on the secure connection.
///
///
/// A used to authenticate the server.
@@ -366,12 +354,12 @@ namespace WebSocketSharp.Server
}
///
- /// Gets or sets a value indicating whether the server cleans up the inactive
- /// sessions periodically.
+ /// Gets or sets a value indicating whether the server cleans up the inactive sessions
+ /// periodically.
///
///
- /// true if the server cleans up the inactive sessions every 60
- /// seconds; otherwise, false. The default value is true.
+ /// true if the server cleans up the inactive sessions every 60 seconds; otherwise,
+ /// false. The default value is true.
///
public bool KeepClean {
get {
@@ -387,9 +375,9 @@ namespace WebSocketSharp.Server
/// Gets the logging functions.
///
///
- /// The default logging level is . If you would
- /// like to change it, you should set the Log.Level property to any of
- /// the enum values.
+ /// The default logging level is . If you would like to change it,
+ /// you should set the Log.Level property to any of the enum
+ /// values.
///
///
/// A that provides the logging functions.
@@ -413,12 +401,11 @@ namespace WebSocketSharp.Server
}
///
- /// Gets or sets the name of the realm associated with the
- /// .
+ /// Gets or sets the name of the realm associated with the server.
///
///
- /// A that represents the name of the realm.
- /// The default value is SECRET AREA.
+ /// A that represents the name of the realm. The default value is
+ /// SECRET AREA.
///
public string Realm {
get {
@@ -434,13 +421,13 @@ namespace WebSocketSharp.Server
}
///
- /// Gets or sets the delegate called to find the credentials for an identity
- /// used to authenticate a client.
+ /// Gets or sets the delegate called to find the credentials for an identity used to
+ /// authenticate a client.
///
///
- /// A Func<, >
- /// delegate that references the method(s) used to find the credentials.
- /// The default value is a function that only returns .
+ /// A Func<, > delegate that
+ /// references the method(s) used to find the credentials. The default value is a function
+ /// that only returns .
///
public Func UserCredentialsFinder {
get {
@@ -456,7 +443,7 @@ namespace WebSocketSharp.Server
}
///
- /// Gets the access to the WebSocket services provided by the .
+ /// Gets the access to the WebSocket services provided by the server.
///
///
/// A that manages the WebSocket services.
@@ -512,8 +499,7 @@ namespace WebSocketSharp.Server
var path = context.Path;
WebSocketServiceHost host;
- if (path == null ||
- !_services.TryGetServiceHostInternally (path, out host)) {
+ if (path == null || !_services.TryGetServiceHostInternally (path, out host)) {
context.Close (HttpStatusCode.NotImplemented);
return;
}
@@ -551,8 +537,7 @@ namespace WebSocketSharp.Server
}
var header = context.Headers ["Authorization"];
- if (header == null ||
- !header.StartsWith (expected, StringComparison.OrdinalIgnoreCase)) {
+ if (header == null || !header.StartsWith (expected, StringComparison.OrdinalIgnoreCase)) {
context.SendAuthChallenge (challenge);
return auth ();
}
@@ -573,7 +558,7 @@ namespace WebSocketSharp.Server
if (_state == ServerState.START || _state == ServerState.SHUTDOWN) {
_logger.Error (
String.Format (
- "The '{0}' property cannot set a value because the server has already been started.",
+ "Set operation of {0} isn't available because the server has already started.",
property));
return false;
@@ -606,9 +591,7 @@ namespace WebSocketSharp.Server
acceptRequestAsync (_listener.AcceptTcpClient ());
}
catch (SocketException ex) {
- _logger.Warn (
- String.Format (
- "Receiving has been stopped.\nreason: {0}.", ex.Message));
+ _logger.Warn (String.Format ("Receiving has been stopped.\nreason: {0}.", ex.Message));
break;
}
@@ -655,74 +638,65 @@ namespace WebSocketSharp.Server
#region Public Methods
///
- /// Adds the specified typed WebSocket service with the specified
- /// .
+ /// Adds the specified typed WebSocket service with the specified .
///
///
- /// This method converts to URL-decoded string
- /// and removes '/' from tail end of .
+ /// This method converts to URL-decoded string and removes '/'
+ /// from tail end of .
///
- ///
- /// A that represents the absolute path to the WebSocket
- /// service.
+ ///
+ /// A that represents the absolute path to the WebSocket service to add.
///
///
- /// The type of the WebSocket service. The TWithNew must inherit the
- /// class and must have a public parameterless
- /// constructor.
+ /// The type of the WebSocket service.
+ /// The TWithNew must inherit the class and must have a public
+ /// parameterless constructor.
///
- public void AddWebSocketService (string servicePath)
+ public void AddWebSocketService (string path)
where TWithNew : WebSocketService, new ()
{
- AddWebSocketService (servicePath, () => new TWithNew ());
+ AddWebSocketService (path, () => new TWithNew ());
}
///
- /// Adds the specified typed WebSocket service with the specified
- /// and .
+ /// Adds the specified typed WebSocket service with the specified
+ /// and .
///
///
///
- /// This method converts to URL-decoded
- /// string and removes '/' from tail end of
- /// .
+ /// This method converts to URL-decoded string and removes '/'
+ /// from tail end of .
///
///
- /// returns a initialized specified
- /// typed WebSocket service instance.
+ /// returns a initialized specified typed
+ /// instance.
///
///
- ///
- /// A that represents the absolute path to the WebSocket
- /// service.
+ ///
+ /// A that represents the absolute path to the WebSocket service to add.
///
- ///
- /// A Func<T> delegate that references the method used to initialize
- /// a new WebSocket service instance (a new WebSocket session).
+ ///
+ /// A Func<T> delegate that references the method used to initialize a new specified
+ /// typed instance (a new
+ /// instance).
///
///
- /// The type of the WebSocket service. The T must inherit the
- /// class.
+ /// The type of the WebSocket service. The T must inherit the
+ /// class.
///
- public void AddWebSocketService (
- string servicePath, Func serviceConstructor)
+ public void AddWebSocketService (string path, Func constructor)
where T : WebSocketService
{
- var msg = servicePath.CheckIfValidServicePath () ??
- (serviceConstructor == null
- ? "'serviceConstructor' must not be null."
- : null);
+ var msg = path.CheckIfValidServicePath () ??
+ (constructor == null ? "'constructor' must not be null." : null);
if (msg != null) {
- _logger.Error (
- String.Format ("{0}\nservice path: {1}", msg, servicePath ?? ""));
+ _logger.Error (String.Format ("{0}\nservice path: {1}", msg, path));
return;
}
- var host = new WebSocketServiceHost (
- servicePath, serviceConstructor, _logger);
-
+ var host = new WebSocketServiceHost (path, constructor, _logger);
if (!KeepClean)
host.KeepClean = false;
@@ -730,32 +704,29 @@ namespace WebSocketSharp.Server
}
///
- /// Removes the WebSocket service with the specified
- /// .
+ /// Removes the WebSocket service with the specified .
///
///
- /// This method converts to URL-decoded string
- /// and removes '/' from tail end of .
+ /// This method converts to URL-decoded string and removes '/'
+ /// from tail end of .
///
///
- /// true if the WebSocket service is successfully found and removed;
- /// otherwise, false.
+ /// true if the WebSocket service is successfully found and removed; otherwise,
+ /// false.
///
- ///
- /// A that represents the absolute path to the WebSocket
- /// service to find.
+ ///
+ /// A that represents the absolute path to the WebSocket service to find.
///
- public bool RemoveWebSocketService (string servicePath)
+ public bool RemoveWebSocketService (string path)
{
- var msg = servicePath.CheckIfValidServicePath ();
+ var msg = path.CheckIfValidServicePath ();
if (msg != null) {
- _logger.Error (
- String.Format ("{0}\nservice path: {1}", msg, servicePath));
+ _logger.Error (String.Format ("{0}\nservice path: {1}", msg, path));
return false;
}
- return _services.Remove (servicePath);
+ return _services.Remove (path);
}
///
@@ -766,9 +737,7 @@ namespace WebSocketSharp.Server
lock (_sync) {
var msg = _state.CheckIfStartable () ?? checkIfCertExists ();
if (msg != null) {
- _logger.Error (
- String.Format (
- "{0}\nstate: {1}\nsecure: {2}", msg, _state, _secure));
+ _logger.Error (String.Format ("{0}\nstate: {1}\nsecure: {2}", msg, _state, _secure));
return;
}
@@ -803,12 +772,11 @@ namespace WebSocketSharp.Server
}
///
- /// Stops receiving the WebSocket connection requests with the specified
- /// and .
+ /// Stops receiving the WebSocket connection requests with the specified
+ /// and .
///
///
- /// A that represents the status code indicating the
- /// reason for stop.
+ /// A that represents the status code indicating the reason for stop.
///
///
/// A that represents the reason for stop.
@@ -823,8 +791,7 @@ namespace WebSocketSharp.Server
if (msg != null) {
_logger.Error (
- String.Format (
- "{0}\nstate: {1}\ncode: {2}\nreason: {3}", msg, _state, code, reason));
+ String.Format ("{0}\nstate: {1}\ncode: {2}\nreason: {3}", msg, _state, code, reason));
return;
}
@@ -843,8 +810,8 @@ namespace WebSocketSharp.Server
/// and .
///
///
- /// One of the enum values, represents the
- /// status code indicating the reason for stop.
+ /// One of the enum values, represents the status code indicating
+ /// the reason for stop.
///
///
/// A that represents the reason for stop.
@@ -857,8 +824,7 @@ namespace WebSocketSharp.Server
(data = ((ushort) code).Append (reason)).CheckIfValidControlData ("reason");
if (msg != null) {
- _logger.Error (
- String.Format ("{0}\nstate: {1}\nreason: {2}", msg, _state, reason));
+ _logger.Error (String.Format ("{0}\nstate: {1}\nreason: {2}", msg, _state, reason));
return;
}