When using httpx.ASGITransport
, aconnect_sse
doesn't yield server sent events for an infinite AsyncGenerator
#4
Labels
external
This depends or is blocked by an external library
Thanks for implementing this library, which might be very useful for testing SSE endpoints.
However, it seems the
aconnect_sse
context manager does not function as expected.Let's consider this first example:
The
events = [sse async for sse in event_source.aiter_sse()]
line will only be executed after 5s (i.e. the time theevents()
function gets executed).Now, let's consider the following example, where the AsyncGenerator yields objects indefinitely (which should be the use case of any SSE endpoint):
In this second example, the
events = [sse async for sse in event_source.aiter_sse()]
line will never be reached because we indefinitely yield fromevents()
.I guess this behaviour is not expected since SSE endpoints are made by design to yield an infinite number of events.
Any solution to this?
The text was updated successfully, but these errors were encountered: