utils.websocket¶
safe_send
async
¶
Safely send a message through WebSocket with error handling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ws
|
WebSocket
|
The WebSocket connection |
required |
event
|
str
|
Event type for the message |
required |
data
|
Any
|
Data to send (will be converted to JSON-safe format) |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if message was sent successfully, False otherwise |