mpetazzoni / sseclient

Pure-Python Server Side Events (SSE) client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no data from events()

williamhuangh opened this issue · comments

this is what a curl to the stream endpoint looks like

* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8686 (#0)
> GET /test/stream HTTP/1.1
> Host: localhost:8686
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< date: Tue, 04 Feb 2020 21:36:52 GMT
< server: uvicorn
< content-type: text/event-stream; charset=utf-8
< cache-control: no-cache
< transfer-encoding: chunked
<

data: {'complete': False, 'failed': False, 'percent': 65, 'message': 'still running', 'detail': None, 'task': 'task'}


the response stream has 2 \ns at the end of the byte string body. is there anything off?

Which version of sseclient and requests are you using? Can you share your code?

I thought the chunked transfer encoding could have something to do with it but I wasn't able to reproduce the issue, regardless of transfer encoding. I created a small Python HTTP server that serves a single event followed by two empty lines (similar to your use-case) and everything worked correctly with sseclient.