Class BusWebSocketEndpoint

java.lang.Object
jakarta.websocket.Endpoint
org.apache.juneau.console.bus.websocket.BusWebSocketEndpoint

public final class BusWebSocketEndpoint extends jakarta.websocket.Endpoint
The per-connection endpoint of the bus's WebSocket transport. Not for direct use: it is public only because the container instantiates it through BusWebSocketConfigurator.

It closes a refused handshake at once (4401 / 4403). Otherwise it adapts the Session to a FrameSink, connects it to the ServerBus (which sends the resync), forwards inbound text frames to ServerBus.receive(org.apache.juneau.console.bus.BusSession, java.lang.String) (which refuses anything but a pub frame with a JSON object payload), and closes with 1009 (bus:frame-too-large) on a frame over BusPolicy.maxFrameBytes. Nothing it logs contains the session id.

It reads the per-connection user properties of its EndpointConfig. The container gives each handshake its own copy of that map (WebSocket 2.1 and later; Jetty and Tomcat do), which is what keeps concurrent connections apart.

Example:

// Do not construct this class; register the endpoint instead: BusWebSockets.register(servletContext, JobsRest.BUS);

Since:
10.0.0
  • Method Details

    • onOpen

      public void onOpen(jakarta.websocket.Session session, jakarta.websocket.EndpointConfig config)
      Specified by:
      onOpen in class jakarta.websocket.Endpoint
    • onClose

      public void onClose(jakarta.websocket.Session session, jakarta.websocket.CloseReason closeReason)
      Overrides:
      onClose in class jakarta.websocket.Endpoint
    • onError

      public void onError(jakarta.websocket.Session session, Throwable thr)
      Overrides:
      onError in class jakarta.websocket.Endpoint