Fix due to the modified Ext.cs, WebSocketServerBase.cs and WebSocketService.cs

This commit is contained in:
sta
2013-01-28 16:22:24 +09:00
parent de3f41dd3a
commit 95382924e0
87 changed files with 1711 additions and 952 deletions

View File

@@ -40,7 +40,7 @@ namespace WebSocketSharp.Server {
/// Provides the functions of the server that receives the WebSocket connection requests.
/// </summary>
/// <remarks>
/// The WebSocketServer class provides multi WebSocket service.
/// The WebSocketServer class provides the multi WebSocket service.
/// </remarks>
public class WebSocketServer : WebSocketServerBase
{
@@ -53,7 +53,7 @@ namespace WebSocketSharp.Server {
#region Public Constructors
/// <summary>
/// Initializes a new instance of the WebSocketServer class.
/// Initializes a new instance of the <see cref="WebSocketServer"/> class.
/// </summary>
public WebSocketServer()
: this(80)
@@ -61,7 +61,7 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
/// Initializes a new instance of the <see cref="WebSocketServer"/> class that listens for incoming connection attempts
/// on the specified <paramref name="port"/>.
/// </summary>
/// <param name="port">
@@ -73,7 +73,7 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
/// Initializes a new instance of the <see cref="WebSocketServer"/> class that listens for incoming connection attempts
/// on the specified WebSocket URL.
/// </summary>
/// <param name="url">
@@ -92,7 +92,7 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
/// Initializes a new instance of the <see cref="WebSocketServer"/> class that listens for incoming connection attempts
/// on the specified <paramref name="port"/> and <paramref name="secure"/>.
/// </summary>
/// <param name="port">
@@ -107,11 +107,11 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
/// Initializes a new instance of the <see cref="WebSocketServer"/> class that listens for incoming connection attempts
/// on the specified <paramref name="address"/> and <paramref name="port"/>.
/// </summary>
/// <param name="address">
/// An <see cref="System.Net.IPAddress"/> that contains an IP address.
/// A <see cref="System.Net.IPAddress"/> that contains an IP address.
/// </param>
/// <param name="port">
/// An <see cref="int"/> that contains a port number.
@@ -122,11 +122,11 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
/// Initializes a new instance of the <see cref="WebSocketServer"/> class that listens for incoming connection attempts
/// on the specified <paramref name="address"/>, <paramref name="port"/> and <paramref name="secure"/>.
/// </summary>
/// <param name="address">
/// An <see cref="System.Net.IPAddress"/> that contains an IP address.
/// A <see cref="System.Net.IPAddress"/> that contains an IP address.
/// </param>
/// <param name="port">
/// An <see cref="int"/> that contains a port number.
@@ -145,12 +145,12 @@ namespace WebSocketSharp.Server {
#region Properties
/// <summary>
/// Gets the service paths.
/// Gets the paths associated with the each WebSocket services.
/// </summary>
/// <value>
/// An IEnumerable&lt;string&gt; that contains the service paths.
/// An IEnumerable&lt;string&gt; that contains the paths.
/// </value>
public IEnumerable<string> ServicePath {
public IEnumerable<string> ServicePaths {
get {
var url = BaseUri.IsAbsoluteUri
? BaseUri.ToString().TrimEnd('/')
@@ -190,16 +190,15 @@ namespace WebSocketSharp.Server {
#region Protected Method
/// <summary>
/// Accepts the WebSocket connection.
/// Accepts a WebSocket connection.
/// </summary>
/// <param name="client">
/// A <see cref="TcpClient"/> that contains the TCP connection.
/// <param name="context">
/// A <see cref="TcpListenerWebSocketContext"/> that contains a WebSocket connection.
/// </param>
protected override void AcceptWebSocket(TcpClient client)
protected override void AcceptWebSocket(TcpListenerWebSocketContext context)
{
var context = client.AcceptWebSocket(IsSecure);
var socket = context.WebSocket;
var path = context.Path.UrlDecode();
var socket = context.WebSocket;
var path = context.Path.UrlDecode();
IServiceHost svcHost;
if (!_services.TryGetServiceHost(path, out svcHost))
@@ -219,13 +218,13 @@ namespace WebSocketSharp.Server {
#region Public Methods
/// <summary>
/// Adds the WebSocket service.
/// Adds a WebSocket service.
/// </summary>
/// <param name="absPath">
/// A <see cref="string"/> that contains an absolute path associated with the WebSocket service.
/// A <see cref="string"/> that contains an absolute path associated with a WebSocket service.
/// </param>
/// <typeparam name="T">
/// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
/// The type of a WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
/// </typeparam>
public void AddService<T>(string absPath)
where T : WebSocketService, new()
@@ -248,7 +247,7 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Broadcasts the specified <see cref="string"/>.
/// Broadcasts the specified <see cref="string"/> to all clients.
/// </summary>
/// <param name="data">
/// A <see cref="string"/> to broadcast.

View File

@@ -31,6 +31,7 @@ using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using WebSocketSharp.Net.WebSockets;
namespace WebSocketSharp.Server {
@@ -44,7 +45,7 @@ namespace WebSocketSharp.Server {
#region Fields
private Thread _acceptClientThread;
private Thread _receiveRequestThread;
private IPAddress _address;
private bool _isSecure;
private bool _isSelfHost;
@@ -57,7 +58,7 @@ namespace WebSocketSharp.Server {
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="WebSocketSharp.Server.WebSocketServerBase"/> class.
/// Initializes a new instance of the <see cref="WebSocketServerBase"/> class.
/// </summary>
protected WebSocketServerBase()
{
@@ -65,7 +66,7 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Initializes a new instance of the <see cref="WebSocketSharp.Server.WebSocketServerBase"/> class that listens for incoming connection attempts
/// Initializes a new instance of the <see cref="WebSocketServerBase"/> class that listens for incoming connection attempts
/// on the specified WebSocket URL.
/// </summary>
/// <param name="url">
@@ -91,17 +92,17 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Initializes a new instance of the <see cref="WebSocketSharp.Server.WebSocketServerBase"/> class that listens for incoming connection attempts
/// Initializes a new instance of the <see cref="WebSocketServerBase"/> class that listens for incoming connection attempts
/// on the specified <paramref name="address"/>, <paramref name="port"/>, <paramref name="absPath"/> and <paramref name="secure"/>.
/// </summary>
/// <param name="address">
/// An <see cref="IPAddress"/> that contains a local IP address.
/// A <see cref="IPAddress"/> that contains an IP address.
/// </param>
/// <param name="port">
/// An <see cref="int"/> that contains a port number.
/// </param>
/// <param name="absPath">
/// A <see cref="string"/> that contains a absolute path.
/// A <see cref="string"/> that contains an absolute path.
/// </param>
/// <param name="secure">
/// A <see cref="bool"/> that indicates providing a secure connection or not. (<c>true</c> indicates providing a secure connection.)
@@ -176,10 +177,10 @@ namespace WebSocketSharp.Server {
#region Public Properties
/// <summary>
/// Gets the local IP address on which to listen for incoming connection attempts.
/// Gets the IP address on which to listen for incoming connection attempts.
/// </summary>
/// <value>
/// A <see cref="IPAddress"/> that contains a local IP address.
/// A <see cref="IPAddress"/> that contains an IP address.
/// </value>
public IPAddress Address {
get {
@@ -188,10 +189,10 @@ namespace WebSocketSharp.Server {
}
/// <summary>
/// Gets a value indicating whether this server is secure.
/// Gets a value indicating whether this server provides secure connection.
/// </summary>
/// <value>
/// <c>true</c> if this server is secure; otherwise, <c>false</c>.
/// <c>true</c> if this server provides secure connection; otherwise, <c>false</c>.
/// </value>
public bool IsSecure {
get {
@@ -236,35 +237,13 @@ namespace WebSocketSharp.Server {
#region Private Methods
private void acceptClient()
private void acceptWebSocketAsync(TcpListenerWebSocketContext context)
{
while (true)
WaitCallback callback = (state) =>
{
try
{
var client = _tcpListener.AcceptTcpClient();
acceptSocketAsync(client);
}
catch (SocketException)
{
// TcpListener has been stopped.
break;
}
catch (Exception ex)
{
onError(ex.Message);
break;
}
}
}
private void acceptSocketAsync(TcpClient client)
{
WaitCallback acceptSocketCb = (state) =>
{
try
{
AcceptWebSocket(client);
AcceptWebSocket(context);
}
catch (Exception ex)
{
@@ -272,7 +251,7 @@ namespace WebSocketSharp.Server {
}
};
ThreadPool.QueueUserWorkItem(acceptSocketCb);
ThreadPool.QueueUserWorkItem(callback);
}
private void init()
@@ -308,11 +287,33 @@ namespace WebSocketSharp.Server {
OnError.Emit(this, new ErrorEventArgs(message));
}
private void startAcceptClientThread()
private void receiveRequest()
{
_acceptClientThread = new Thread(new ThreadStart(acceptClient));
_acceptClientThread.IsBackground = true;
_acceptClientThread.Start();
while (true)
{
try
{
var context = _tcpListener.AcceptWebSocket(_isSecure);
acceptWebSocketAsync(context);
}
catch (SocketException)
{
// TcpListener has been stopped.
break;
}
catch (Exception ex)
{
onError(ex.Message);
break;
}
}
}
private void startReceiveRequestThread()
{
_receiveRequestThread = new Thread(new ThreadStart(receiveRequest));
_receiveRequestThread.IsBackground = true;
_receiveRequestThread.Start();
}
private bool tryCreateUri(string uriString, out Uri result, out string message)
@@ -335,15 +336,15 @@ namespace WebSocketSharp.Server {
#region Protected Methods
/// <summary>
/// Accepts the WebSocket connection.
/// Accepts a WebSocket connection.
/// </summary>
/// <param name="client">
/// A <see cref="TcpClient"/> that contains the WebSocket connection.
/// <param name="context">
/// A <see cref="TcpListenerWebSocketContext"/> that contains a WebSocket connection.
/// </param>
protected abstract void AcceptWebSocket(TcpClient client);
protected abstract void AcceptWebSocket(TcpListenerWebSocketContext context);
/// <summary>
/// Occurs the <see cref="WebSocketServerBase.OnError"/> event with the specified <paramref name="message"/>.
/// Occurs the <see cref="WebSocketServerBase.OnError"/> event with the specified <see cref="string"/>.
/// </summary>
/// <param name="message">
/// A <see cref="string"/> that contains an error message.
@@ -366,7 +367,7 @@ namespace WebSocketSharp.Server {
return;
_tcpListener.Start();
startAcceptClientThread();
startReceiveRequestThread();
}
/// <summary>
@@ -378,7 +379,7 @@ namespace WebSocketSharp.Server {
return;
_tcpListener.Stop();
_acceptClientThread.Join(5 * 1000);
_receiveRequestThread.Join(5 * 1000);
}
#endregion

View File

@@ -33,6 +33,12 @@ using System.Threading;
namespace WebSocketSharp.Server {
/// <summary>
/// Provides the basic functions of the WebSocket service.
/// </summary>
/// <remarks>
/// The WebSocketService class is an abstract class.
/// </remarks>
public abstract class WebSocketService {
#region Private Fields
@@ -44,6 +50,9 @@ namespace WebSocketSharp.Server {
#region Public Constructor
/// <summary>
/// Initializes a new instance of the <see cref="WebSocketService"/> class.
/// </summary>
public WebSocketService()
{
ID = String.Empty;
@@ -54,12 +63,24 @@ namespace WebSocketSharp.Server {
#region Protected Properties
/// <summary>
/// Gets the HTTP query string variables used in the WebSocket opening handshake.
/// </summary>
/// <value>
/// A <see cref="NameValueCollection"/> that contains the query string variables.
/// </value>
protected NameValueCollection QueryString {
get {
return IsBound ? _socket.QueryString : null;
}
}
/// <summary>
/// Gets the sessions to the WebSocket service.
/// </summary>
/// <value>
/// A <see cref="SessionManager"/> that contains the sessions to the WebSocket service.
/// </value>
protected SessionManager Sessions {
get {
return IsBound ? _sessions : null;
@@ -70,44 +91,46 @@ namespace WebSocketSharp.Server {
#region Public Properties
public string ID { get; private set; }
public bool IsBound { get; private set; }
/// <summary>
/// Gets the ID of a <see cref="WebSocketService"/> instance.
/// </summary>
/// <value>
/// A <see cref="string"/> that contains a ID.
/// </value>
public string ID { get; private set; }
/// <summary>
/// Gets a value indicating whether a <see cref="WebSocketService"/> instance is bound to a <see cref="WebSocket"/>.
/// </summary>
/// <value>
/// <c>true</c> if the WebSocketService is bound to a WebSocket; otherwise, <c>false</c>.
/// </value>
public bool IsBound { get; private set; }
#endregion
#region Private Method
#region Private Methods
private void defaultBind()
private void onClose(object sender, CloseEventArgs e)
{
_socket.OnOpen += (sender, e) =>
{
ID = _sessions.Add(this);
};
_socket.OnClose += (sender, e) =>
{
_sessions.Remove(ID);
};
_sessions.Remove(ID);
OnClose(e);
}
#endregion
#region Protected Methods
protected virtual void OnClose(object sender, CloseEventArgs e)
private void onError(object sender, ErrorEventArgs e)
{
OnError(e);
}
protected virtual void OnError(object sender, ErrorEventArgs e)
private void onMessage(object sender, MessageEventArgs e)
{
OnMessage(e);
}
protected virtual void OnMessage(object sender, MessageEventArgs e)
{
}
protected virtual void OnOpen(object sender, EventArgs e)
private void onOpen(object sender, EventArgs e)
{
ID = _sessions.Add(this);
OnOpen();
}
#endregion
@@ -126,27 +149,148 @@ namespace WebSocketSharp.Server {
#endregion
#region Protected Methods
/// <summary>
/// Occurs when a inner <see cref="WebSocket"/> receives a Close frame or the Stop method is called.
/// </summary>
/// <param name="e">
/// A <see cref="CloseEventArgs"/> that contains the event data associated with a <see cref="WebSocket.OnClose"/> event.
/// </param>
protected virtual void OnClose(CloseEventArgs e)
{
}
/// <summary>
/// Occurs when a inner <see cref="WebSocket"/> gets an error.
/// </summary>
/// <param name="e">
/// An <see cref="ErrorEventArgs"/> that contains the event data associated with a <see cref="WebSocket.OnError"/> event.
/// </param>
protected virtual void OnError(ErrorEventArgs e)
{
}
/// <summary>
/// Occurs when a inner <see cref="WebSocket"/> receives a data frame.
/// </summary>
/// <param name="e">
/// A <see cref="MessageEventArgs"/> that contains the event data associated with a <see cref="WebSocket.OnMessage"/> event.
/// </param>
protected virtual void OnMessage(MessageEventArgs e)
{
}
/// <summary>
/// Occurs when the WebSocket connection has been established.
/// </summary>
protected virtual void OnOpen()
{
}
#endregion
#region Public Methods
/// <summary>
/// Binds the specified <see cref="WebSocket"/> and <see cref="SessionManager"/>
/// to a <see cref="WebSocketService"/> instance.
/// </summary>
/// <param name="socket">
/// A <see cref="WebSocket"/> to bind to the WebSocketService.
/// </param>
/// <param name="sessions">
/// A <see cref="SessionManager"/> to bind to the WebSocketService.
/// </param>
public void Bind(WebSocket socket, SessionManager sessions)
{
if (IsBound)
return;
_socket = socket;
_sessions = sessions;
defaultBind();
_socket.OnOpen += OnOpen;
_socket.OnMessage += OnMessage;
_socket.OnError += OnError;
_socket.OnClose += OnClose;
_socket.OnOpen += onOpen;
_socket.OnMessage += onMessage;
_socket.OnError += onError;
_socket.OnClose += onClose;
IsBound = true;
}
/// <summary>
/// Broadcasts the specified array of <see cref="byte"/> to all clients of the WebSocket service.
/// </summary>
/// <param name="data">
/// An array of <see cref="byte"/> to broadcast.
/// </param>
public void Broadcast(byte[] data)
{
if (IsBound)
_sessions.Broadcast(data);
}
/// <summary>
/// Broadcasts the specified <see cref="string"/> to all clients of the WebSocket service.
/// </summary>
/// <param name="data">
/// A <see cref="string"/> to broadcast.
/// </param>
public void Broadcast(string data)
{
if (IsBound)
_sessions.Broadcast(data);
}
/// <summary>
/// Pings to all clients of the WebSocket service.
/// </summary>
/// <returns>
/// A Dictionary&lt;string, bool&gt; that contains the collection of the ID and value
/// indicating whether the WebSocket service received a Pong in a time.
/// </returns>
public Dictionary<string, bool> Broadping()
{
return Broadping(String.Empty);
}
/// <summary>
/// Pings with the specified <see cref="string"/> to all clients of the WebSocket service.
/// </summary>
/// <returns>
/// A Dictionary&lt;string, bool&gt; that contains the collection of the ID and value
/// indicating whether the WebSocket service received a Pong in a time.
/// </returns>
/// <param name="message">
/// A <see cref="string"/> that contains a message.
/// </param>
public Dictionary<string, bool> Broadping(string message)
{
return IsBound
? _sessions.Broadping(message)
: null;
}
/// <summary>
/// Pings to the client of a <see cref="WebSocketService"/> instance.
/// </summary>
/// <returns>
/// <c>true</c> if the WebSocketService receives a Pong in a time; otherwise, <c>false</c>.
/// </returns>
public bool Ping()
{
return Ping(String.Empty);
}
/// <summary>
/// Pings with the specified <see cref="string"/> to the client of a <see cref="WebSocketService"/> instance.
/// </summary>
/// <returns>
/// <c>true</c> if the WebSocketService receives a Pong in a time; otherwise, <c>false</c>.
/// </returns>
/// <param name="message">
/// A <see cref="string"/> that contains a message.
/// </param>
public bool Ping(string message)
{
return IsBound
@@ -154,23 +298,33 @@ namespace WebSocketSharp.Server {
: false;
}
public Dictionary<string, bool> PingAround()
{
return PingAround(String.Empty);
}
public Dictionary<string, bool> PingAround(string message)
{
return IsBound
? _sessions.Broadping(message)
: null;
}
/// <summary>
/// Pings to the client of a <see cref="WebSocketService"/> instance associated with the specified ID.
/// </summary>
/// <returns>
/// <c>true</c> if the WebSocket service receives a Pong in a time; otherwise, <c>false</c>.
/// </returns>
/// <param name="id">
/// A <see cref="string"/> that contains a ID that represents the destination for the Ping.
/// </param>
public bool PingTo(string id)
{
return PingTo(id, String.Empty);
}
/// <summary>
/// Pings with the specified <see cref="string"/> to the client of a <see cref="WebSocketService"/> instance
/// associated with the specified ID.
/// </summary>
/// <returns>
/// <c>true</c> if the WebSocketService receives a Pong in a time; otherwise, <c>false</c>.
/// </returns>
/// <param name="id">
/// A <see cref="string"/> that contains a ID that represents the destination for the Ping.
/// </param>
/// <param name="message">
/// A <see cref="string"/> that contains a message.
/// </param>
public bool PingTo(string id, string message)
{
if (!IsBound)
@@ -182,30 +336,39 @@ namespace WebSocketSharp.Server {
: false;
}
public void Publish(byte[] data)
{
if (IsBound)
_sessions.Broadcast(data);
}
public void Publish(string data)
{
if (IsBound)
_sessions.Broadcast(data);
}
/// <summary>
/// Sends a binary data to the client of a <see cref="WebSocketService"/> instance.
/// </summary>
/// <param name="data">
/// An array of <see cref="byte"/> that contains a binary data to send.
/// </param>
public void Send(byte[] data)
{
if (IsBound)
_socket.Send(data);
}
/// <summary>
/// Sends a text data to the client of a <see cref="WebSocketService"/> instance.
/// </summary>
/// <param name="data">
/// A <see cref="string"/> that contains a text data to send.
/// </param>
public void Send(string data)
{
if (IsBound)
_socket.Send(data);
}
/// <summary>
/// Sends a binary data to the client of a <see cref="WebSocketService"/> instance associated with the specified ID.
/// </summary>
/// <param name="id">
/// A <see cref="string"/> that contains a ID that represents the destination for the data.
/// </param>
/// <param name="data">
/// An array of <see cref="byte"/> that contains a binary data to send.
/// </param>
public void SendTo(string id, byte[] data)
{
if (!IsBound)
@@ -216,6 +379,15 @@ namespace WebSocketSharp.Server {
service.Send(data);
}
/// <summary>
/// Sends a text data to the client of a <see cref="WebSocketService"/> instance associated with the specified ID.
/// </summary>
/// <param name="id">
/// A <see cref="string"/> that contains a ID that represents the destination for the data.
/// </param>
/// <param name="data">
/// A <see cref="string"/> that contains a text data to send.
/// </param>
public void SendTo(string id, string data)
{
if (!IsBound)
@@ -226,12 +398,18 @@ namespace WebSocketSharp.Server {
service.Send(data);
}
/// <summary>
/// Starts a <see cref="WebSocketService"/> instance.
/// </summary>
public void Start()
{
if (IsBound)
_socket.Connect();
}
/// <summary>
/// Stops a <see cref="WebSocketService"/> instance.
/// </summary>
public void Stop()
{
if (!IsBound)
@@ -240,11 +418,29 @@ namespace WebSocketSharp.Server {
_socket.Close();
}
/// <summary>
/// Stops a <see cref="WebSocketService"/> instance with the specified <see cref="CloseStatusCode"/> and <see cref="string"/>.
/// </summary>
/// <param name="code">
/// One of the <see cref="CloseStatusCode"/> values that contains a status code indicating the reason for stop.
/// </param>
/// <param name="reason">
/// A <see cref="string"/> that contains a reason for stop.
/// </param>
public void Stop(CloseStatusCode code, string reason)
{
Stop((ushort)code, reason);
}
/// <summary>
/// Stops a <see cref="WebSocketService"/> instance with the specified <see cref="ushort"/> and <see cref="string"/>.
/// </summary>
/// <param name="code">
/// A <see cref="ushort"/> that contains a status code indicating the reason for stop.
/// </param>
/// <param name="reason">
/// A <see cref="string"/> that contains a reason for stop.
/// </param>
public void Stop(ushort code, string reason)
{
if (!IsBound)

View File

@@ -32,6 +32,7 @@ using System;
using System.Collections.Generic;
using System.Net.Sockets;
using WebSocketSharp.Net;
using WebSocketSharp.Net.WebSockets;
namespace WebSocketSharp.Server {
@@ -39,7 +40,7 @@ namespace WebSocketSharp.Server {
/// Provides the functions of the server that receives the WebSocket connection requests.
/// </summary>
/// <remarks>
/// The WebSocketServiceHost&lt;T&gt; class provides single WebSocket service.
/// The WebSocketServiceHost&lt;T&gt; class provides the single WebSocket service.
/// </remarks>
/// <typeparam name="T">
/// The type of the WebSocket service that the server provides. The T must inherit the <see cref="WebSocketService"/> class.
@@ -142,7 +143,7 @@ namespace WebSocketSharp.Server {
/// on the specified <paramref name="address"/>, <paramref name="port"/> and <paramref name="absPath"/>.
/// </summary>
/// <param name="address">
/// An <see cref="System.Net.IPAddress"/> that contains an IP address.
/// A <see cref="System.Net.IPAddress"/> that contains an IP address.
/// </param>
/// <param name="port">
/// An <see cref="int"/> that contains a port number.
@@ -160,7 +161,7 @@ namespace WebSocketSharp.Server {
/// on the specified <paramref name="address"/>, <paramref name="port"/>, <paramref name="absPath"/> and <paramref name="secure"/>.
/// </summary>
/// <param name="address">
/// An <see cref="System.Net.IPAddress"/> that contains an IP address.
/// A <see cref="System.Net.IPAddress"/> that contains an IP address.
/// </param>
/// <param name="port">
/// An <see cref="int"/> that contains a port number.
@@ -244,16 +245,15 @@ namespace WebSocketSharp.Server {
#region Protected Method
/// <summary>
/// Accepts the WebSocket connection.
/// Accepts a WebSocket connection.
/// </summary>
/// <param name="client">
/// A <see cref="TcpClient"/> that contains the TCP connection.
/// <param name="context">
/// A <see cref="TcpListenerWebSocketContext"/> that contains a WebSocket connection.
/// </param>
protected override void AcceptWebSocket(TcpClient client)
protected override void AcceptWebSocket(TcpListenerWebSocketContext context)
{
var context = client.AcceptWebSocket(IsSecure);
var socket = context.WebSocket;
var path = context.Path.UrlDecode();
var socket = context.WebSocket;
var path = context.Path.UrlDecode();
if (path != Uri.GetAbsolutePath().UrlDecode())
{
socket.Close(HttpStatusCode.NotImplemented);
@@ -271,7 +271,7 @@ namespace WebSocketSharp.Server {
#region Public Methods
/// <summary>
/// Broadcasts the specified <see cref="string"/>.
/// Broadcasts the specified <see cref="string"/> to all clients.
/// </summary>
/// <param name="data">
/// A <see cref="string"/> to broadcast.
@@ -284,6 +284,10 @@ namespace WebSocketSharp.Server {
/// <summary>
/// Pings with the specified <see cref="string"/> to all clients.
/// </summary>
/// <returns>
/// A Dictionary&lt;string, bool&gt; that contains the collection of the session ID and value
/// indicating whether the server received a Pong in a time.
/// </returns>
/// <param name="message">
/// A <see cref="string"/> that contains a message.
/// </param>