Interface BusSession


public interface BusSession
One page's bridge session. Created by the session POST; reused across reconnects within the grace period.

The session's capability id is deliberately not on this interface: it never leaves the bus module except in the session POST response, and toString() redacts it.

Example:

bus.publishTo(s -> "east".equals(s.attribute("region")), "ops.alert:east", alert);

Since:
10.0.0
  • Method Details

    • bridgeId

      The bridge id from the page contract (C1 id pattern).
      Returns:
      The bridge id. Never null.
    • transport

      The transport requested by the session POST.
      Returns:
      "sse" or "websocket".
    • principalName

      The name of the request principal recorded when the session was opened.
      Returns:
      The principal name, or null when the request was anonymous.
    • attribute

      Parameters:
      name - The attribute name.
      Returns:
      The value, or null if absent.
    • downstream

      The downstream topics and patterns this session was granted, in request order.
      Returns:
      An unmodifiable set.
    • upstream

      The upstream topics this session was granted (WebSocket sessions only), in request order.
      Returns:
      An unmodifiable set.
    • isConnected

      boolean isConnected()
      Whether a transport connection is currently attached.
      Returns:
      true while a stream or socket is connected.