Comments (2)
I think that this is an issue with the backend, rather than the client. One way to verify whether my guess is right would be to load the same SSE URL from JavaScript code in a browser (like, just do new EventSource("http://localhost:8888/events")
), look in the browser's Network tab, and see if it's showing any event traffic. Or, just do curl --raw http://localhost:8888/events
from a Linux command line and see if the events are showing up as they're sent. If not, then the problem is not on the client side.
The client that we're using here is OkHttp, which handles gzip compression transparently. However, often when you enable gzip on a server, it will want to buffer the responses by default - since compression algorithms of this kind work best if you already know what the most frequently used characters are before you start doing the compression, which assumes that you've already seen more than a tiny piece of the data. And SSE can't work if the response is being buffered, no matter what client implementation you're using.
Of course, without access to your server, I have no way to know if that's the issue - and if I'm right, I can't give you any advice on how to disable buffering on your server, since that's a general issue that's outside the scope of maintaining the okhttp-eventsource code. And, again, we did not write the OkHttp client implementation so I'm not sure how much we would be able to do about this in any case. Still, please let me know what you see from either of the tests I mentioned above.
from okhttp-eventsource.
I think i found the reason why this approach not work, just remove
headerBuilder.add("Accept-Encoding", "br, gzip, deflate");
from okhttp-eventsource.
Related Issues (20)
- HttpBasic Auth HOT 2
- Default EventSources have a funny Logger Name HOT 3
- Possibility to override default headers HOT 2
- Bug: cleaning up threadpools does not work? HOT 4
- EventSource.restart() throws java.lang.NoClassDefFoundError HOT 2
- android.os.NetworkOnMainThreadException when closing. HOT 2
- Setting log level to BODY deactivates EventHandler HOT 5
- Different header for every reconnect HOT 6
- Dynamically update SSE URL in case of reconnect HOT 6
- [ClassNotFoundException] Didn't find class "java.time.Duration" HOT 4
- jitpack builds failed HOT 3
- how to add security token? HOT 2
- OPEN state but no messages HOT 3
- Already shut downed eventSource its eventHandler's onOpen() method is still called afterwards HOT 2
- Support POST request
- Latest version doesn't connect to the server properly [4.1.0] HOT 4
- Maven dependecy is not get resolved ( Env: Intellij Idea Community Edition HOT 1
- I can't open the doc website http://javadoc.io/doc/com.launchdarkly/okhttp-eventsource HOT 2
- High frequency messages are missed [4.1.1] HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okhttp-eventsource.