SkyWay Unity SDK
公式APIリファレンス
読み取り中…
検索中…
一致する文字列を見つけられません
WebSocketSharp.Server.WebSocketServer クラス

Provides a WebSocket protocol server. [詳解]

公開メンバ関数

 WebSocketServer ()
 Initializes a new instance of the WebSocketServer class.
 
 WebSocketServer (int port)
 Initializes a new instance of the WebSocketServer class with the specified port.
 
 WebSocketServer (string url)
 Initializes a new instance of the WebSocketServer class with the specified URL.
 
 WebSocketServer (int port, bool secure)
 Initializes a new instance of the WebSocketServer class with the specified port and boolean if secure or not.
 
 WebSocketServer (System.Net.IPAddress address, int port)
 Initializes a new instance of the WebSocketServer class with the specified IP address and port.
 
 WebSocketServer (System.Net.IPAddress address, int port, bool secure)
 Initializes a new instance of the WebSocketServer class with the specified IP address, port, and boolean if secure or not.
 
void AddWebSocketService< TBehavior > (string path)
 Adds a WebSocket service with the specified behavior and path.
 
void AddWebSocketService< TBehavior > (string path, Action< TBehavior > initializer)
 Adds a WebSocket service with the specified behavior, path, and initializer.
 
bool RemoveWebSocketService (string path)
 Removes a WebSocket service with the specified path.
 
void Start ()
 Starts receiving incoming handshake requests.
 
void Stop ()
 Stops receiving incoming handshake requests.
 

プロパティ

System.Net.IPAddress Address [get]
 Gets the IP address of the server.
 
AuthenticationSchemes AuthenticationSchemes [get, set]
 Gets or sets the scheme used to authenticate the clients.
 
bool IsListening [get]
 Gets a value indicating whether the server has started.
 
bool IsSecure [get]
 Gets a value indicating whether the server provides secure connections.
 
bool KeepClean [get, set]
 Gets or sets a value indicating whether the server cleans up the inactive sessions periodically.
 
Logger Log [get]
 Gets the logging function for the server.
 
int Port [get]
 Gets the port of the server.
 
string Realm [get, set]
 Gets or sets the name of the realm associated with the server.
 
bool ReuseAddress [get, set]
 Gets or sets a value indicating whether the server is allowed to be bound to an address that is already in use.
 
ServerSslConfiguration SslConfiguration [get]
 Gets the configuration for secure connection.
 
Func< IIdentity, NetworkCredentialUserCredentialsFinder [get, set]
 Gets or sets the delegate called to find the credentials for an identity used to authenticate a client.
 
TimeSpan WaitTime [get, set]
 Gets or sets the time to wait for the response to the WebSocket Ping or Close.
 
WebSocketServiceManager WebSocketServices [get]
 Gets the management function for the WebSocket services provided by the server.
 

詳解

Provides a WebSocket protocol server.

This class can provide multiple WebSocket services.

構築子と解体子

◆ WebSocketServer() [1/6]

WebSocketSharp.Server.WebSocketServer.WebSocketServer ( )
inline

Initializes a new instance of the WebSocketServer class.

The new instance listens for incoming handshake requests on System.Net.IPAddress.Any and port 80.

◆ WebSocketServer() [2/6]

WebSocketSharp.Server.WebSocketServer.WebSocketServer ( int port)
inline

Initializes a new instance of the WebSocketServer class with the specified port.

The new instance listens for incoming handshake requests on System.Net.IPAddress.Any and port .

It provides secure connections if port is 443.

引数
portAn int that specifies the number of the port on which to listen.
例外
ArgumentOutOfRangeExceptionport is less than 1 or greater than 65535.

◆ WebSocketServer() [3/6]

WebSocketSharp.Server.WebSocketServer.WebSocketServer ( string url)
inline

Initializes a new instance of the WebSocketServer class with the specified URL.

The new instance listens for incoming handshake requests on the IP address and port of url .

Either port 80 or 443 is used if url includes no port. Port 443 is used if the scheme of url is wss; otherwise, port 80 is used.

The new instance provides secure connections if the scheme of url is wss.

引数
urlA string that specifies the WebSocket URL of the server.
例外
ArgumentExceptionurl is an empty string. -or- url is invalid.
ArgumentNullExceptionurl is null.

◆ WebSocketServer() [4/6]

WebSocketSharp.Server.WebSocketServer.WebSocketServer ( int port,
bool secure )
inline

Initializes a new instance of the WebSocketServer class with the specified port and boolean if secure or not.

The new instance listens for incoming handshake requests on System.Net.IPAddress.Any and port .

引数
portAn int that specifies the number of the port on which to listen.
secureA bool: true if the new instance provides secure connections; otherwise, false.
例外
ArgumentOutOfRangeExceptionport is less than 1 or greater than 65535.

◆ WebSocketServer() [5/6]

WebSocketSharp.Server.WebSocketServer.WebSocketServer ( System.Net.IPAddress address,
int port )
inline

Initializes a new instance of the WebSocketServer class with the specified IP address and port.

The new instance listens for incoming handshake requests on address and port .

It provides secure connections if port is 443.

引数
addressA System.Net.IPAddress that specifies the local IP address on which to listen.
portAn int that specifies the number of the port on which to listen.
例外
ArgumentExceptionaddress is not a local IP address.
ArgumentNullExceptionaddress is null.
ArgumentOutOfRangeExceptionport is less than 1 or greater than 65535.

◆ WebSocketServer() [6/6]

WebSocketSharp.Server.WebSocketServer.WebSocketServer ( System.Net.IPAddress address,
int port,
bool secure )
inline

Initializes a new instance of the WebSocketServer class with the specified IP address, port, and boolean if secure or not.

The new instance listens for incoming handshake requests on address and port .

引数
addressA System.Net.IPAddress that specifies the local IP address on which to listen.
portAn int that specifies the number of the port on which to listen.
secureA bool: true if the new instance provides secure connections; otherwise, false.
例外
ArgumentExceptionaddress is not a local IP address.
ArgumentNullExceptionaddress is null.
ArgumentOutOfRangeExceptionport is less than 1 or greater than 65535.

関数詳解

◆ AddWebSocketService< TBehavior >() [1/2]

void WebSocketSharp.Server.WebSocketServer.AddWebSocketService< TBehavior > ( string path)
inline

Adds a WebSocket service with the specified behavior and path.

引数
pathA string that specifies an absolute path to the service to add. / is trimmed from the end of the string if present.
テンプレート引数
TBehaviorThe type of the behavior for the service. It must inherit the WebSocketBehavior class. Also it must have a public parameterless constructor.
例外
ArgumentExceptionpath is an empty string. -or- path is not an absolute path. -or- path includes either or both query and fragment components. -or- path is already in use.
ArgumentNullExceptionpath is null.
型制約
TBehavior :WebSocketBehavior 
TBehavior :new 

◆ AddWebSocketService< TBehavior >() [2/2]

void WebSocketSharp.Server.WebSocketServer.AddWebSocketService< TBehavior > ( string path,
Action< TBehavior > initializer )
inline

Adds a WebSocket service with the specified behavior, path, and initializer.

引数
pathA string that specifies an absolute path to the service to add. / is trimmed from the end of the string if present.
initializerAn T:System.Action<TBehavior> delegate. It specifies the delegate called when the service initializes a new session instance. null if not necessary.
テンプレート引数
TBehaviorThe type of the behavior for the service. It must inherit the WebSocketBehavior class. Also it must have a public parameterless constructor.
例外
ArgumentExceptionpath is an empty string. -or- path is not an absolute path. -or- path includes either or both query and fragment components. -or- path is already in use.
ArgumentNullExceptionpath is null.
型制約
TBehavior :WebSocketBehavior 
TBehavior :new 

◆ RemoveWebSocketService()

bool WebSocketSharp.Server.WebSocketServer.RemoveWebSocketService ( string path)
inline

Removes a WebSocket service with the specified path.

The service is stopped with close status 1001 (going away) if the current state of the service is Start.

戻り値
true if the service is successfully found and removed; otherwise, false.
引数
pathA string that specifies an absolute path to the service to remove. / is trimmed from the end of the string if present.
例外
ArgumentExceptionpath is an empty string. -or- path is not an absolute path. -or- path includes either or both query and fragment components.
ArgumentNullExceptionpath is null.

◆ Start()

void WebSocketSharp.Server.WebSocketServer.Start ( )
inline

Starts receiving incoming handshake requests.

This method works if the current state of the server is Ready or Stop.

例外
InvalidOperationExceptionThere is no server certificate for secure connection. -or- The underlying TcpListener has failed to start.

◆ Stop()

void WebSocketSharp.Server.WebSocketServer.Stop ( )
inline

Stops receiving incoming handshake requests.

This method works if the current state of the server is Start.

プロパティ詳解

◆ Address

System.Net.IPAddress WebSocketSharp.Server.WebSocketServer.Address
get

Gets the IP address of the server.

A System.Net.IPAddress that represents the local IP address on which to listen for incoming handshake requests.

◆ AuthenticationSchemes

AuthenticationSchemes WebSocketSharp.Server.WebSocketServer.AuthenticationSchemes
getset

Gets or sets the scheme used to authenticate the clients.

The set operation works if the current state of the server is Ready or Stop.

One of the WebSocketSharp.Net.AuthenticationSchemes enum values.

It represents the scheme used to authenticate the clients.

The default value is WebSocketSharp.Net.AuthenticationSchemes.Anonymous.

◆ IsListening

bool WebSocketSharp.Server.WebSocketServer.IsListening
get

Gets a value indicating whether the server has started.

true if the server has started; otherwise, false.

◆ IsSecure

bool WebSocketSharp.Server.WebSocketServer.IsSecure
get

Gets a value indicating whether the server provides secure connections.

true if the server provides secure connections; otherwise, false.

◆ KeepClean

bool WebSocketSharp.Server.WebSocketServer.KeepClean
getset

Gets or sets a value indicating whether the server cleans up the inactive sessions periodically.

The set operation works if the current state of the server is Ready or Stop.

true if the server cleans up the inactive sessions every 60 seconds; otherwise, false.

The default value is false.

◆ Log

Logger WebSocketSharp.Server.WebSocketServer.Log
get

Gets the logging function for the server.

The default logging level is LogLevel.Error.

A Logger that provides the logging function.

◆ Port

int WebSocketSharp.Server.WebSocketServer.Port
get

Gets the port of the server.

An int that represents the number of the port on which to listen for incoming handshake requests.

◆ Realm

string WebSocketSharp.Server.WebSocketServer.Realm
getset

Gets or sets the name of the realm associated with the server.

The set operation works if the current state of the server is Ready or Stop.

A string that represents the name of the realm.

"SECRET AREA" is used as the name of the realm if the value is null or an empty string.

The default value is null.

◆ ReuseAddress

bool WebSocketSharp.Server.WebSocketServer.ReuseAddress
getset

Gets or sets a value indicating whether the server is allowed to be bound to an address that is already in use.

You should set this property to true if you would like to resolve to wait for socket in TIME_WAIT state.

The set operation works if the current state of the server is Ready or Stop.

true if the server is allowed to be bound to an address that is already in use; otherwise, false.

The default value is false.

◆ SslConfiguration

ServerSslConfiguration WebSocketSharp.Server.WebSocketServer.SslConfiguration
get

Gets the configuration for secure connection.

The configuration is used when the server attempts to start, so it must be configured before the start method is called.

A ServerSslConfiguration that represents the configuration used to provide secure connections.

例外
InvalidOperationExceptionThe server does not provide secure connections.

◆ UserCredentialsFinder

Func<IIdentity, NetworkCredential> WebSocketSharp.Server.WebSocketServer.UserCredentialsFinder
getset

Gets or sets the delegate called to find the credentials for an identity used to authenticate a client.

The set operation works if the current state of the server is Ready or Stop.

A T:System.Func<IIdentity, NetworkCredential> delegate.

It represents the delegate called when the server finds the credentials used to authenticate a client.

It must return null if the credentials are not found.

null if not necessary.

The default value is null.

◆ WaitTime

TimeSpan WebSocketSharp.Server.WebSocketServer.WaitTime
getset

Gets or sets the time to wait for the response to the WebSocket Ping or Close.

The set operation works if the current state of the server is Ready or Stop.

A TimeSpan that represents the time to wait for the response.

The default value is the same as 1 second.

例外
ArgumentOutOfRangeExceptionThe value specified for a set operation is zero or less.

◆ WebSocketServices

WebSocketServiceManager WebSocketSharp.Server.WebSocketServer.WebSocketServices
get

Gets the management function for the WebSocket services provided by the server.

A WebSocketServiceManager that manages the WebSocket services provided by the server.


このクラス詳解は次のファイルから抽出されました: