Skip to content

WebSocket endpoint

*.websocket binds a JS / TS handler to a STOMP-over-WebSocket endpoint.

  • File format. JSON descriptor.
  • Synchronizer. WebsocketsSynchronizer.
  • Engine. engine-websockets.
  • Editor. Websockets editor.
  • URL. Reachable at /websockets/stomp/<endpoint>.
  • See also. Java @Websocket - annotation-based alternative for client Java.

File format

json
{
  "location": "/myproject/websockets/notifications.websocket",
  "handler": "myproject/websockets/notifications-handler.js",
  "endpoint": "notifications",
  "description": "Push notifications stream"
}
FieldPurpose
locationRegistry path of the descriptor.
handlerRegistry path of the JS / TS module. Called on onOpen, onMessage, onClose, onError.
endpointURL suffix. The endpoint above is reached at /websockets/stomp/notifications.
descriptionFree text.

The handler module dispatches on a method variable in scope (onOpen / onMessage / onClose / onError). Use @aerokit/sdk/net/websocket to send frames back to the client.

Java alternative - @Websocket

A client .java class annotated with @Websocket(endpoint = "notifications") registers without a .websocket artefact. See WebSockets.

Released under the EPL-2.0 License.