aiohttp-debugtoolbar icon indicating copy to clipboard operation
aiohttp-debugtoolbar copied to clipboard

Fix SSE endpoint

Open jettify opened this issue 9 years ago • 3 comments

Portend sse implementation works like simple polling so easily could be switched to ajax or websokets for message push. Javascript and backend implementation should be fixed.

jettify avatar Apr 05 '15 10:04 jettify

I want help, but I can not understand how it works. It is looks like it send one request per second to http://127.0.0.1:9000/_debugtoolbar/sse?request_id=313339383833313133303438313638 and get the same data every time.

iho avatar May 30 '15 16:05 iho

You are right this SSE work more like regular polling then actual server push. The reason why data is the same because you do not have new request since last poll. Try to refresh page of demo app in separate tab and you will see new data in SSE request.

jettify avatar Jun 01 '15 18:06 jettify

I think the /sse endpoint simply closes the connection like a regular request, forcing the client to reopen it: https://github.com/aio-libs/aiohttp-debugtoolbar/blob/master/aiohttp_debugtoolbar/views.py#L156

Instead of switching to websockets, we can probably just fix this endpoint by using aiohttp-sse or something: https://github.com/aio-libs/aiohttp-sse#example

This is probably a simple task and shouldn't require making any changes to the client code.

Dreamsorcerer avatar Jan 08 '22 18:01 Dreamsorcerer