Skip to main content

websocket_service

Attribute Macro websocket_service 

Source
#[websocket_service]
Expand description

The Java @WebSocketService(value, namespace) analog: registers a websocket server endpoint declaratively. The annotated struct implements ComposableFunction and receives the session lifecycle events (type: open / string / bytes / close) on its per-connection {session}.in route; replies go to the tx_path given in the headers.

#[websocket_service("graph")]                     // /ws/graph/{token}
struct GraphUserInterface;

#[websocket_service(name = "json", namespace = "ws")]
struct JsonPathHandler;

The AppStarter lifecycle collects these entries and registers the URL paths before the HTTP server starts; the server itself starts when REST automation is enabled or at least one websocket service exists (Java parity). One function object is created per connection.