Class RealtimeHub

java.lang.Object
com.kingsrook.qqq.middleware.javalin.realtime.RealtimeHub
All Implemented Interfaces:
AutoCloseable

public class RealtimeHub extends Object implements AutoCloseable
One server connection registry. Replay stays session-bound and is re-filtered at delivery.
  • Constructor Details

    • RealtimeHub

      public RealtimeHub(QInstance instance)
      Start one bus subscription and a daemon maintenance timer.
    • RealtimeHub

      public RealtimeHub(QInstance instance, Clock clock)
      A clock seam makes retention and permission rechecks deterministic in tests.
  • Method Details

    • connect

      public RealtimeHub.Attachment connect(QSession session, String lastEventId)
      Attach a transport, resuming only an owned connection with a retained event id.
    • subscriptions

      public Map<String,List<String>> subscriptions(QSession session, String connectionId, List<String> add, List<String> remove) throws QNotFoundException
      Ownership is intentionally indistinguishable from a missing connection.
      Throws:
      QNotFoundException
    • disconnect

      public void disconnect(RealtimeHub.Attachment attachment)
      Transport closure retains subscriptions for the replay window.
    • maintenance

      public void maintenance()
      Validate expiry at each heartbeat and periodically recheck every channel.
    • endSession

      public void endSession(String sessionUuid)
      Logout closes every stream belonging to this session.
    • close

      public void close()
      Unsubscribe and release all streams and the maintenance timer.
      Specified by:
      close in interface AutoCloseable