sUNC Reference
WebSocket
Create and use client WebSocket connections.
Related to sUNC documentation
This reference is based exclusively on the official sUNC documentation.
Overview
- The WebSocket class is a client and cannot create servers.
- sUNC explicitly requires secure `wss://` support.
Constructor
Connects to a ws:// or wss:// endpoint.
function WebSocket.connect(url: string): WebSocketEvents
| Name | Type | Description |
|---|---|---|
OnMessage | (message: string) -> () | Fires when a message is received. |
OnClose | () -> () | Fires when the connection closes. |
Methods
| Name | Type | Description |
|---|---|---|
Send(message) | () | Sends a message. |
Close() | () | Closes the connection. |