-
Hi, I'm implementing a REST API application (of course in python) using Litestar which is served by a granian web server. Requesting a specific endpoint results in open a notification streams based on SSE. The response is a basic AsyncGenerator as described in litestar SSE response documentation. async def notification_publisher(
self,
dynamic_id,
application_service: ApplicationService,
channels: ChannelsPlugin
) -> AsyncGenerator[SSEData, None]:
# Seems to be needed to trigger the first reply (header)
#yield ServerSentEventMessage(None)
subscriber = await channels.subscribe(str(dynamic_id))
async for notification in subscriber.iter_events():
yield ServerSentEventMessage(data=f"{notification.decode()}") When testing this endpoint, I don't get any header response while I don't get notified and then send a first SSE notification (the yield in the async for loop is not reached). I was exepecting to get at least an HTTP header response. I tried the same piece of code using hypercorn and resulting in the expected behavior. I can provide wireshark capture if needed. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This looks like a bug in the ASGI implementation. Please open an issue. |
Beta Was this translation helpful? Give feedback.
This looks like a bug in the ASGI implementation. Please open an issue.