Interface FrameSink
ServerBus.connect(BusSession, FrameSink) for one connection.
offer(String) must not block: it queues the frame and returns at once, or returns BusPolicy.maxQueuedFrames()) is full. On close(int, String) with 4429 / bus:slow-consumer.
close(int, String) must not block either: the bus calls it while holding its lock. A transport that needs a
network handshake to close must hand the close off to another thread.
Close codes the bus uses: 1001 bus:closed (ServerBus.close()), 4401
bus:unknown-session (expired), 4409 bus:replaced (a second connection took over the session)
and 4429 bus:slow-consumer. A transport without close codes (SSE) ends its response instead.
Example:
- Since:
- 10.0.0
-
Method Summary
-
Method Details
-
offer
Queues one encoded frame for sending. Must not block.- Parameters:
frame- The encoded frame (seeBusFrames).- Returns:
false when the connection's queue is full or the sink is closed.
-
close
Closes the connection. Called at most once by the bus for a given sink; must be safe to call again.- Parameters:
code- The close code (1001,4401,4409or4429).reason- Thebus:*reason.
-