Websocket
Extends:
Application Socket
This is just an abstraction above the standard browser provided WebSocket
class.
Since this class implements the EventHandler, use the .on('event')
pattern instead of .onevent
.
Constructor Summary
Public Constructor | ||
public |
constructor(name: string, uri: string, options: WebsocketOptions) Create a new Websocket |
Member Summary
Public Members | ||
public |
If socket is closed |
|
public |
If socket is connected |
|
public |
If socket failed to connect |
|
public |
If socket is connecting |
|
public |
connection: WebSocket The Websocket |
|
public |
Options |
|
public |
If socket is reconnecting |
|
public |
Socket URI |
Method Summary
Public Methods | ||
public |
close(args: ...*): * Wrapper for closing |
|
public |
Opens the connection |
|
public |
send(args: ...*): * Wrapper for sending data |
Private Methods | ||
private |
Attaches internal events |
|
private |
_destroyConnection(): void Destroys the current connection |
Public Constructors
public constructor(name: string, uri: string, options: WebsocketOptions) source
Create a new Websocket
Params:
Name | Type | Attribute | Description |
name | string | Instance name |
|
uri | string | Connection URI |
|
options | WebsocketOptions |
|
Websocket options |
Public Members
Public Methods
public close(args: ...*): * source
Wrapper for closing
Params:
Name | Type | Attribute | Description |
args | ...* |
Return:
* |
public open(reconnect: boolean) source
Opens the connection
Params:
Name | Type | Attribute | Description |
reconnect | boolean |
|
Force reconnection |
public send(args: ...*): * source
Wrapper for sending data
Params:
Name | Type | Attribute | Description |
args | ...* |
Return:
* |