diff --git a/websocket-sharp/Server/IWebSocketSession.cs b/websocket-sharp/Server/IWebSocketSession.cs
index c323da00..587776dd 100644
--- a/websocket-sharp/Server/IWebSocketSession.cs
+++ b/websocket-sharp/Server/IWebSocketSession.cs
@@ -38,6 +38,19 @@ namespace WebSocketSharp.Server
{
#region Properties
+ ///
+ /// Gets the current state of the WebSocket connection for the session.
+ ///
+ ///
+ ///
+ /// One of the enum values.
+ ///
+ ///
+ /// It indicates the current state of the connection.
+ ///
+ ///
+ WebSocketState ConnectionState { get; }
+
///
/// Gets the information in the WebSocket handshake request.
///
@@ -73,19 +86,6 @@ namespace WebSocketSharp.Server
///
DateTime StartTime { get; }
- ///
- /// Gets the current state of the WebSocket connection for the session.
- ///
- ///
- ///
- /// One of the enum values.
- ///
- ///
- /// It indicates the current state of the connection.
- ///
- ///
- WebSocketState State { get; }
-
#endregion
}
}
diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs
index d75ae616..2d191cb2 100644
--- a/websocket-sharp/Server/WebSocketBehavior.cs
+++ b/websocket-sharp/Server/WebSocketBehavior.cs
@@ -112,6 +112,29 @@ namespace WebSocketSharp.Server
#region Public Properties
+ ///
+ /// Gets the current state of the WebSocket connection for a session.
+ ///
+ ///
+ ///
+ /// One of the enum values.
+ ///
+ ///
+ /// It indicates the current state of the connection.
+ ///
+ ///
+ /// if the session has not
+ /// started yet.
+ ///
+ ///
+ public WebSocketState ConnectionState {
+ get {
+ return _websocket != null
+ ? _websocket.ReadyState
+ : WebSocketState.Connecting;
+ }
+ }
+
///
/// Gets the information in a handshake request to the WebSocket service.
///
@@ -299,7 +322,7 @@ namespace WebSocketSharp.Server
}
set {
- if (State != WebSocketState.Connecting) {
+ if (ConnectionState != WebSocketState.Connecting) {
var msg = "The session has already started.";
throw new InvalidOperationException (msg);
}
@@ -334,29 +357,6 @@ namespace WebSocketSharp.Server
}
}
- ///
- /// Gets the current state of the WebSocket connection for a session.
- ///
- ///
- ///
- /// One of the enum values.
- ///
- ///
- /// It indicates the current state of the connection.
- ///
- ///
- /// if the session has not
- /// started yet.
- ///
- ///
- public WebSocketState State {
- get {
- return _websocket != null
- ? _websocket.ReadyState
- : WebSocketState.Connecting;
- }
- }
-
#endregion
#region Private Methods
diff --git a/websocket-sharp/Server/WebSocketSessionManager.cs b/websocket-sharp/Server/WebSocketSessionManager.cs
index 32d59c85..f7144b0c 100644
--- a/websocket-sharp/Server/WebSocketSessionManager.cs
+++ b/websocket-sharp/Server/WebSocketSessionManager.cs
@@ -1639,7 +1639,7 @@ namespace WebSocketSharp.Server
IWebSocketSession session;
if (_sessions.TryGetValue (id, out session)) {
- var state = session.State;
+ var state = session.ConnectionState;
if (state == WebSocketState.Open)
session.Context.WebSocket.Close (CloseStatusCode.Abnormal);
else if (state == WebSocketState.Closing)