new WebSocketClient()
- Source:
Methods
(static) createInterface(wssUrl, clientCtor, options) → {Promise.<Transworker>}
Create a worker and an interface instance for the thread.
Parameters:
Name | Type | Description |
---|---|---|
wssUrl |
string | A WebSocket server url. |
clientCtor |
function | client-class constructor. |
options |
TransWorker.Options | Options to create a wrapper object for the main thread. |
- Source:
Returns:
The created TransWorker instance.
- Type
- Promise.<Transworker>
connectWorker(url) → {Promise}
Connect to a WebSocket server.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | WebSocket server end point. |
- Source:
Returns:
A promise that is resolved when the connection is establish.
- Type
- Promise
postMessage(message) → {undefined}
Post message.
Parameters:
Name | Type | Description |
---|---|---|
message |
object | a message object. |
- Source:
Returns:
- Type
- undefined