Added some XML documentation comments
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2012 sta.blockhead
|
||||
* Copyright (c) 2012-2013 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
|
||||
@@ -32,9 +32,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using WebSocketSharp.Net;
|
||||
using WebSocketSharp.Net.WebSockets;
|
||||
|
||||
namespace WebSocketSharp.Server {
|
||||
|
||||
/// <summary>
|
||||
/// Provides the functions of the server that receives the WebSocket connection requests.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The WebSocketServer class provides multi WebSocket service.
|
||||
/// </remarks>
|
||||
public class WebSocketServer : WebSocketServerBase
|
||||
{
|
||||
#region Field
|
||||
@@ -45,16 +52,33 @@ namespace WebSocketSharp.Server {
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the WebSocketServer class.
|
||||
/// </summary>
|
||||
public WebSocketServer()
|
||||
: this(80)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
|
||||
/// on the specified <paramref name="port"/>.
|
||||
/// </summary>
|
||||
/// <param name="port">
|
||||
/// An <see cref="int"/> that contains a port number.
|
||||
/// </param>
|
||||
public WebSocketServer(int port)
|
||||
: this(System.Net.IPAddress.Any, port)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
|
||||
/// on the specified WebSocket URL.
|
||||
/// </summary>
|
||||
/// <param name="url">
|
||||
/// A <see cref="string"/> that contains a WebSocket URL.
|
||||
/// </param>
|
||||
public WebSocketServer(string url)
|
||||
: base(url)
|
||||
{
|
||||
@@ -67,16 +91,49 @@ namespace WebSocketSharp.Server {
|
||||
init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the WebSocketServer class that listens for incoming connection attempts
|
||||
/// on the specified <paramref name="port"/> and <paramref name="secure"/>.
|
||||
/// </summary>
|
||||
/// <param name="port">
|
||||
/// An <see cref="int"/> that contains a port number.
|
||||
/// </param>
|
||||
/// <param name="secure">
|
||||
/// A <see cref="bool"/> that indicates providing a secure connection or not. (<c>true</c> indicates providing a secure connection.)
|
||||
/// </param>
|
||||
public WebSocketServer(int port, bool secure)
|
||||
: this(System.Net.IPAddress.Any, port, secure)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the 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.
|
||||
/// </param>
|
||||
/// <param name="port">
|
||||
/// An <see cref="int"/> that contains a port number.
|
||||
/// </param>
|
||||
public WebSocketServer(System.Net.IPAddress address, int port)
|
||||
: this(address, port, port == 443 ? true : false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the 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.
|
||||
/// </param>
|
||||
/// <param name="port">
|
||||
/// An <see cref="int"/> that contains a port number.
|
||||
/// </param>
|
||||
/// <param name="secure">
|
||||
/// A <see cref="bool"/> that indicates providing a secure connection or not. (<c>true</c> indicates providing a secure connection.)
|
||||
/// </param>
|
||||
public WebSocketServer(System.Net.IPAddress address, int port, bool secure)
|
||||
: base(address, port, "/", secure)
|
||||
{
|
||||
@@ -85,8 +142,14 @@ namespace WebSocketSharp.Server {
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the service paths.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// An IEnumerable<string> that contains the service paths.
|
||||
/// </value>
|
||||
public IEnumerable<string> ServicePath {
|
||||
get {
|
||||
var url = BaseUri.IsAbsoluteUri
|
||||
@@ -97,6 +160,12 @@ namespace WebSocketSharp.Server {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the server cleans up the inactive client.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if the server cleans up the inactive client; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool Sweeped {
|
||||
get {
|
||||
return _services.Sweeped;
|
||||
@@ -120,6 +189,12 @@ namespace WebSocketSharp.Server {
|
||||
|
||||
#region Protected Method
|
||||
|
||||
/// <summary>
|
||||
/// Accepts the WebSocket connection.
|
||||
/// </summary>
|
||||
/// <param name="client">
|
||||
/// A <see cref="TcpClient"/> that contains the TCP connection.
|
||||
/// </param>
|
||||
protected override void AcceptWebSocket(TcpClient client)
|
||||
{
|
||||
var context = client.AcceptWebSocket(IsSecure);
|
||||
@@ -143,6 +218,15 @@ namespace WebSocketSharp.Server {
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds the WebSocket service.
|
||||
/// </summary>
|
||||
/// <param name="absPath">
|
||||
/// A <see cref="string"/> that contains an absolute path associated with the WebSocket service.
|
||||
/// </param>
|
||||
/// <typeparam name="T">
|
||||
/// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
|
||||
/// </typeparam>
|
||||
public void AddService<T>(string absPath)
|
||||
where T : WebSocketService, new()
|
||||
{
|
||||
@@ -163,11 +247,20 @@ namespace WebSocketSharp.Server {
|
||||
_services.Add(absPath, svcHost);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Broadcasts the specified <see cref="string"/>.
|
||||
/// </summary>
|
||||
/// <param name="data">
|
||||
/// A <see cref="string"/> to broadcast.
|
||||
/// </param>
|
||||
public void Broadcast(string data)
|
||||
{
|
||||
_services.Broadcast(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops receiving the WebSocket connection requests.
|
||||
/// </summary>
|
||||
public override void Stop()
|
||||
{
|
||||
base.Stop();
|
||||
|
||||
Reference in New Issue
Block a user