mpetazzoni / sseclient

Pure-Python Server Side Events (SSE) client
Apache License 2.0
195 stars 33 forks source link

When using urllib3 no data received. #20

Open CutePotatoDev opened 4 years ago

CutePotatoDev commented 4 years ago

Python 3.6.7 urllib3 1.25.7 sseclient-py 1.7

When using with urllib3 not get my messages. looks like issue is: https://github.com/mpetazzoni/sseclient/blob/16a29bb43de7ab98e3516a64e2ab421dece8d78d/sseclient/__init__.py#L48 It's never get chunks of data. I track down problem to this place: https://github.com/urllib3/urllib3/blob/93e5c6a5bb12a67a89bd8b24584d64a3102b2096/src/urllib3/response.py#L543 urllib3 waiting 65536 bytes of data and only then dispatch chunk. After overriding: https://github.com/urllib3/urllib3/blob/93e5c6a5bb12a67a89bd8b24584d64a3102b2096/src/urllib3/response.py#L794 and decreasing amt size, messages start arriving as expected.

bablokb commented 1 year ago

Did you hardwire your overrides, or did you subclass urllib3? And did you test the alternative (normal requests)?

CutePotatoDev commented 1 year ago

Did you hardwire your overrides, or did you subclass urllib3? And did you test the alternative (normal requests)?

Oh... it happens 3 years ago. I not even really remember anything from back then. I try scan my code archive and found more info how i solve this problem back then.

bablokb commented 1 year ago

I solved this in my code by switching from the urllib3-package to requests-package. But your analysis was important to understand it was not a problem of my own code.