diff --git a/websocket-sharp/Server/IWebSocketSession.cs b/websocket-sharp/Server/IWebSocketSession.cs index 9aae92f7..051d1dfc 100644 --- a/websocket-sharp/Server/IWebSocketSession.cs +++ b/websocket-sharp/Server/IWebSocketSession.cs @@ -4,8 +4,8 @@ * * The MIT License * - * Copyright (c) 2013 sta.blockhead - * + * Copyright (c) 2013-2014 sta.blockhead + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights @@ -15,7 +15,7 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -32,7 +32,7 @@ using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// - /// Exposes the properties for the session to the WebSocket service. + /// Exposes the access to the session to the WebSocket service. /// public interface IWebSocketSession { @@ -40,15 +40,16 @@ namespace WebSocketSharp.Server /// Gets the WebSocket connection request information. /// /// - /// A that contains the WebSocket connection request information. + /// A that represents the WebSocket connection + /// request. /// WebSocketContext Context { get; } /// - /// Gets the unique ID of the session to the WebSocket service. + /// Gets the unique ID of the session. /// /// - /// A that contains the unique ID of the session. + /// A that represents the unique ID of the session. /// string ID { get; } @@ -56,7 +57,8 @@ namespace WebSocketSharp.Server /// Gets the time that the session has been started. /// /// - /// A that represents the time that the session has been started. + /// A that represents the time that the session has + /// been started. /// DateTime StartTime { get; } @@ -64,7 +66,8 @@ namespace WebSocketSharp.Server /// Gets the state of the WebSocket connection. /// /// - /// One of the values. + /// One of the values that indicate the state of + /// the WebSocket connection. /// WebSocketState State { get; } } diff --git a/websocket-sharp/Server/WebSocketService.cs b/websocket-sharp/Server/WebSocketService.cs index 2d9d051d..05cb26aa 100644 --- a/websocket-sharp/Server/WebSocketService.cs +++ b/websocket-sharp/Server/WebSocketService.cs @@ -27,18 +27,15 @@ #endregion using System; -using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; -using System.Text; -using System.Threading; using WebSocketSharp.Net; using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// - /// Provides the basic functions of the WebSocket service used by the WebSocket service host. + /// Provides the basic functions of the WebSocket service provided by the + /// or . /// /// /// The WebSocketService class is an abstract class. @@ -54,12 +51,12 @@ namespace WebSocketSharp.Server #endregion - #region Public Constructors + #region Protected Constructors /// /// Initializes a new instance of the class. /// - public WebSocketService () + protected WebSocketService () { _start = DateTime.MaxValue; } @@ -72,8 +69,8 @@ namespace WebSocketSharp.Server /// Gets or sets the logging functions. /// /// - /// If you want to change the current logger to the service own logger, you set this property - /// to a new instance that you created. + /// If you want to change the current logger to the service own logger, you + /// set this property to a new instance that you created. /// /// /// A that provides the logging functions. @@ -95,7 +92,8 @@ namespace WebSocketSharp.Server /// Gets the manager of the sessions to the WebSocket service. /// /// - /// A that manages the sessions to the WebSocket service. + /// A that manages the sessions to the + /// WebSocket service. /// protected WebSocketSessionManager Sessions { get { @@ -111,7 +109,8 @@ namespace WebSocketSharp.Server /// Gets the WebSocket connection request information. /// /// - /// A that contains the WebSocket connection request information. + /// A that represents the WebSocket connection + /// request. /// public WebSocketContext Context { get { @@ -123,18 +122,20 @@ namespace WebSocketSharp.Server /// Gets the unique ID of the current instance. /// /// - /// A that contains the unique ID. + /// A that represents the unique ID of the current + /// instance. /// public string ID { get; private set; } /// - /// Gets the time that the current instance has been started. + /// Gets the time that the current instance + /// has been started. /// /// - /// A that represents the time that the current - /// instance has been started. + /// A that represents the time that the current + /// instance has been started. /// public DateTime StartTime { get { @@ -146,7 +147,8 @@ namespace WebSocketSharp.Server /// Gets the state of the WebSocket connection. /// /// - /// One of the values. + /// One of the values that indicate the state of + /// the WebSocket connection. /// public WebSocketState State { get { @@ -214,14 +216,15 @@ namespace WebSocketSharp.Server #region Protected Methods /// - /// Calls the method with the specified . + /// Calls the method with the specified + /// . /// /// - /// A that contains an error message. + /// A that represents the error message. /// protected void Error (string message) { - if (!message.IsNullOrEmpty ()) + if (message != null && message.Length > 0) OnError (new ErrorEventArgs (message)); } @@ -229,20 +232,20 @@ namespace WebSocketSharp.Server /// Is called when the WebSocket connection has been closed. /// /// - /// A that contains an event data associated with - /// an inner event. + /// A that contains the event data associated + /// with an inner event. /// protected virtual void OnClose (CloseEventArgs e) { } /// - /// Is called when the inner or current - /// gets an error. + /// Is called when the inner or current + /// gets an error. /// /// - /// An that contains an event data associated with - /// an inner event. + /// An that contains the event data associated + /// with an inner event. /// protected virtual void OnError (ErrorEventArgs e) { @@ -252,8 +255,8 @@ namespace WebSocketSharp.Server /// Is called when the inner receives a data frame. /// /// - /// A that contains an event data associated with - /// an inner event. + /// A that contains the event data associated + /// with an inner event. /// protected virtual void OnMessage (MessageEventArgs e) { @@ -267,11 +270,12 @@ namespace WebSocketSharp.Server } /// - /// Sends a Ping to the client of the current instance. + /// Sends a Ping to the client of the current + /// instance. /// /// - /// true if the current instance receives a Pong - /// from the client in a time; otherwise, false. + /// true if the current instance + /// receives a Pong from the client in a time; otherwise, false. /// protected bool Ping () { @@ -281,15 +285,15 @@ namespace WebSocketSharp.Server } /// - /// Sends a Ping with the specified to the client of - /// the current instance. + /// Sends a Ping with the specified to the client + /// of the current instance. /// /// - /// true if the current instance receives a Pong - /// from the client in a time; otherwise, false. + /// true if the current instance + /// receives a Pong from the client in a time; otherwise, false. /// /// - /// A that contains a message to send. + /// A that represents the message to send. /// protected bool Ping (string message) { @@ -390,7 +394,7 @@ namespace WebSocketSharp.Server /// This method doesn't wait for the send to be complete. /// /// - /// A that contains the text data to send. + /// A that represents the text data to send. /// /// /// An Action<bool> delegate that references the method(s) called when @@ -439,14 +443,14 @@ namespace WebSocketSharp.Server } /// - /// Stops the current instance with the specified - /// and . + /// Stops the current instance with the + /// specified and . /// /// - /// A that contains a status code indicating the reason for stop. + /// A that represents the status code for stop. /// /// - /// A that contains the reason for stop. + /// A that represents the reason for stop. /// protected void Stop (ushort code, string reason) { @@ -455,15 +459,15 @@ namespace WebSocketSharp.Server } /// - /// Stops the current instance with the specified - /// and . + /// Stops the current instance with the + /// specified and . /// /// - /// One of the values that indicates a status code - /// indicating the reason for stop. + /// One of the values that indicate the status + /// codes for stop. /// /// - /// A that contains the reason for stop. + /// A that represents the reason for stop. /// protected void Stop (CloseStatusCode code, string reason) { @@ -472,24 +476,26 @@ namespace WebSocketSharp.Server } /// - /// Validates the cookies used in the WebSocket connection request. + /// Validates the HTTP Cookies used in the WebSocket connection request. /// /// /// This method is called when the inner validates /// the WebSocket connection request. /// /// - /// true if the cookies is valid; otherwise, false. - /// The default returns true. + /// true if the cookies is valid; otherwise, false. This method + /// returns true as default. /// /// - /// A that contains a collection of the HTTP Cookies - /// to validate. + /// A that contains the collection of the + /// cookies to validate. /// /// - /// A that receives the HTTP Cookies to send to the client. + /// A that receives the cookies to send to the + /// client. /// - protected virtual bool ValidateCookies (CookieCollection request, CookieCollection response) + protected virtual bool ValidateCookies ( + CookieCollection request, CookieCollection response) { return true; }