Models
WebSocket Message
datadivr.transport.models.WebSocketMessage
Bases: BaseModel
A model representing a WebSocket message.
This model defines the structure of messages sent between WebSocket clients and servers. It includes fields for event identification, payload data, routing information, and optional text messages.
Attributes:
Name | Type | Description |
---|---|---|
event_name |
str
|
The name of the event this message represents |
payload |
Any | None
|
Optional data associated with the message |
to |
str
|
The recipient identifier (defaults to "others") |
from_id |
str
|
The sender identifier (defaults to "server") |
message |
str | None
|
Optional text message content |
websocket |
WebSocket | None
|
Optional WebSocket reference |
Example
Source code in datadivr/transport/models.py
options: show_root_heading: true show_source: true