websocket-sharp : WebSocketSharp.Server Namespace

# WebSocketServerBase Class

Provides the basic functions of the server that receives the WebSocket connection requests.

## Syntax

public abstract class WebSocketServerBase

## Remarks

The WebSocketServerBase class is an abstract class.

## Requirements

Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)

## Members

See Also: Inherited members from object.

## Protected Constructors

| WebSocketServerBase () | Initializes a new instance of the WebSocketSharp.Server.WebSocketServerBase class.
| WebSocketServerBase (string) | Initializes a new instance of the WebSocketSharp.Server.WebSocketServerBase class that listens for incoming connection attempts on the specified WebSocket URL.
| WebSocketServerBase (System.Net.IPAddress, int, string, bool) | Initializes a new instance of the WebSocketSharp.Server.WebSocketServerBase class that listens for incoming connection attempts on the specified address, port, absPath and secure.

## Public Properties

[read-only] | Address | System.Net.IPAddress . Gets the local IP address on which to listen for incoming connection attempts.
[read-only] | IsSecure | bool . Gets a value indicating whether the server provides secure connection.
[read-only] | IsSelfHost | bool . Gets a value indicating whether the server is self host.
[read-only] | Port | int . Gets the port on which to listen for incoming connection attempts.

## Protected Properties

| BaseUri | Uri . Gets or sets the WebSocket URL on which to listen for incoming connection attempts.

## Public Methods

Start ()

> Starts to receive the WebSocket connection requests.

Stop ()

> Stops receiving the WebSocket connection requests.

## Protected Methods

abstract

AcceptWebSocket (WebSocketSharp.Net.WebSockets.TcpListenerWebSocketContext)

> Accepts a WebSocket connection request.

Error (string)

> Occurs the WebSocketServerBase.OnError event with the specified string.

## Public Events

| OnError | Occurs when the server gets an error.

## Extension Methods

static

IsNull<T> (this T) : bool

> Determines whether the specified object is `null`.

static

IsNullDo<T> (this T, Action) : bool

> Determines whether the specified object is `null`. And invokes the specified Action delegate if the specified object is `null`.

## Member Details

### WebSocketServerBase Constructor

> Initializes a new instance of the WebSocketSharp.Server.WebSocketServerBase class.

> ## Syntax

> protected WebSocketServerBase ()

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### WebSocketServerBase Constructor

> Initializes a new instance of the WebSocketSharp.Server.WebSocketServerBase class that listens for incoming connection attempts on the specified WebSocket URL.

> ## Syntax

> protected WebSocketServerBase (string url)

> #### Parameters

> > url
> >   A string that contains a WebSocket URL.

> #### Exceptions

> > Type | Reason
> > --- | ---
> > ArgumentNullException | url is `null`.
> > ArgumentException | url is invalid.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### WebSocketServerBase Constructor

> Initializes a new instance of the WebSocketSharp.Server.WebSocketServerBase class that listens for incoming connection attempts on the specified address, port, absPath and secure.

> ## Syntax

> protected WebSocketServerBase (System.Net.IPAddress address, int port, string absPath, bool secure)

> #### Parameters

> > address
> >   A System.Net.IPAddress that contains a local IP address.
> > port
> >   An int that contains a port number.
> > absPath
> >   A string that contains an absolute path.
> > secure
> >   A bool that indicates providing a secure connection or not. (`true` indicates providing a secure connection.)

> #### Exceptions

> > Type | Reason
> > --- | ---
> > ArgumentNullException | Either address or absPath is `null`.
> > ArgumentException | absPath is invalid. -or- Pair of port and secure is invalid.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### AcceptWebSocket Method

> Accepts a WebSocket connection request.

> ## Syntax

> protected abstract void AcceptWebSocket (WebSocketSharp.Net.WebSockets.TcpListenerWebSocketContext context)

> #### Parameters

> > context
> >   A WebSocketSharp.Net.WebSockets.TcpListenerWebSocketContext that contains the WebSocket connection request objects.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Address Property

> Gets the local IP address on which to listen for incoming connection attempts.

> ## Syntax

> public System.Net.IPAddress Address { get; }

> #### Value

> > A System.Net.IPAddress that contains a local IP address.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### BaseUri Property

> Gets or sets the WebSocket URL on which to listen for incoming connection attempts.

> ## Syntax

> protected Uri BaseUri { get; set; }

> #### Value

> > A Uri that contains a WebSocket URL.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Error Method

> Occurs the WebSocketServerBase.OnError event with the specified string.

> ## Syntax

> protected virtual void Error (string message)

> #### Parameters

> > message
> >   A string that contains an error message.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### IsSecure Property

> Gets a value indicating whether the server provides secure connection.

> ## Syntax

> public bool IsSecure { get; }

> #### Value

> > `true` if the server provides secure connection; otherwise, `false`.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### IsSelfHost Property

> Gets a value indicating whether the server is self host.

> ## Syntax

> public bool IsSelfHost { get; }

> #### Value

> > `true` if the server is self host; otherwise, `false`.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### OnError Event

> Occurs when the server gets an error.

> ## Syntax

> public event EventHandler<WebSocketSharp.ErrorEventArgs> OnError

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Port Property

> Gets the port on which to listen for incoming connection attempts.

> ## Syntax

> public int Port { get; }

> #### Value

> > An int that contains a port number.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Start Method

> Starts to receive the WebSocket connection requests.

> ## Syntax

> public virtual void Start ()

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)

### Stop Method

> Stops receiving the WebSocket connection requests.

> ## Syntax

> public virtual void Stop ()

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: WebSocketSharp.Server
> Assembly: websocket-sharp (in websocket-sharp.dll)