WebSocket Resource
The WebSocket Resource provides methods to manage a connection to a WebSocket server for realtime communciation
Properties
Environment Profiles
| Prop | profiles |
|---|---|
| Type | array |
| Default | [ { 'URL': '', 'environment': '' } ] |
The profiles configured for this resource in an environment
Environment Profile
| Prop | profiles[] |
|---|---|
| Type | object |
| Default | undefined |
A profile of this resource for an environment
Server URL
| Prop | profiles[].URL |
|---|---|
| Type | string |
| Default | undefined |
The URL of the WebSocket Server. Must start with ws:// or wss://
Socket
| Prop | profiles[].socket |
|---|---|
| Type | unknown |
| Default | undefined |
The current opened socket, if any
Environment
| Prop | profiles[].environment |
|---|---|
| Type | string |
| Default | undefined |
The name of the environment with which this profile is associated
Actions
Open a connection
Creates a new WebSocket connection to the specified server, or returns an existing connection.
| Parameter | Type | Default |
|---|---|---|
onOpen | ({ function: { ref: string } } | null) | undefined |
onClose | ({ function: { ref: string } } | null) | undefined |
onMessage | ({ function: { ref: string } } | null) | undefined |
onError | ({ function: { ref: string } } | null) | undefined |
Send a message
Sends a message on the WebSocket connection associated with this resource, if it exists.
| Parameter | Type | Default |
|---|---|---|
message | unknown | undefined |
Close the connection
Closes the WebSocket connection associated with this resource, if it exists.
| Parameter | Type | Default |
|---|