bedrock.websockets
WebSockets enable real-time, bidirectional communication between clients and servers. This module contains classes and functions to establish and manage WebSocket routes and connections, handle WebSocket events and messages, and provide utilities for integrating WebSocket functionality into the Bedrock application.
The main routes available for Websocket connections are:
- connect - establishes a new WebSocket connection
- authenticate - authenticates the connection
- subscribe - subscribes to a topic
- default - handles messages that don't match any other route
- ping - checks if the connection is still alive
- send_message - sends a message to a topic
- unsubscribe - unsubscribes from a topic
- disconnect - disconnects the WebSocket connection
The handlers for these routes are defined in
routes.py
If you want to define your own endpoint to listen for messages on a Websocket topic, you can create a new class that inherits from WebsocketEndpoint and place it in your /app/websocket_endpoints/ folder.
This will allow you to override the on_message method and handle messages received on the WebSocket connection in a custom way.
More details on setting up and using WebSockets in Bedrock applications can be found on our docs portal.
1""" 2WebSockets enable real-time, bidirectional communication between clients and servers. 3This module contains classes and functions to establish and manage WebSocket routes and connections, handle WebSocket events and messages, and provide utilities for integrating WebSocket functionality into the Bedrock application. 4 5The main routes available for Websocket connections are: 6* connect - establishes a new WebSocket connection 7* authenticate - authenticates the connection 8* subscribe - subscribes to a topic 9* default - handles messages that don't match any other route 10* ping - checks if the connection is still alive 11* send_message - sends a message to a topic 12* unsubscribe - unsubscribes from a topic 13* disconnect - disconnects the WebSocket connection 14The handlers for these routes are defined in `routes.py` 15 16If you want to define your own endpoint to listen for messages on a Websocket topic, you can create a new class that inherits from [WebsocketEndpoint](./websockets/endpoint_with_websocket.html) and place it in your `/app/websocket_endpoints/` folder. 17This will allow you to override the `on_message` method and handle messages received on the WebSocket connection in a custom way. 18 19More details on setting up and using WebSockets in Bedrock applications can be found on our [docs portal](https://docs.keyholding.com/doc/websocket-apis-TjRyoRlJt4). 20"""