PhoenixTestDatastar.StreamAdapter
(PhoenixTestDatastar v0.0.2)
Copy Markdown
Custom Plug adapter for testing long-lived SSE connections.
This adapter intercepts send_chunked/3 and chunk/2 calls,
forwarding chunks as messages to a subscriber process. This allows
tests to consume SSE events from handlers that enter long-lived
receive loops (e.g., waiting for PubSub messages).
How it works
- The adapter wraps the standard test adapter
- When
send_chunked/3is called, it notifies the subscriber - When
chunk/2is called, it sends the chunk content to the subscriber - The subscriber can
receivethese messages and parse them as SSE events