Comments (7)
Hi looking at the stack trace seems that the error comes when reading from the SSE channel, this means that is receiving sth that cause an EOF. Does not look that you are doing something wrong on the client, neither the OkSse
Do you have access to the response from the server or a way to read what is sending?
How long it takes from the first read till you get the exception? I am thinking that maybe the OkHttpclient is closing the channel if it does not read anything for some time.
Although this should not be the cases since you are using the default constructor
public OkSse() {
this(new OkHttpClient.Builder().readTimeout(0, TimeUnit.SECONDS).retryOnConnectionFailure(true).build());
}
from oksse.
It takes exactly 60 seconds before we see the EOFException. Every time.
This almost makes me think that this may be a configuration issue.
I checked the response that we receive as I was wondering if it may have contained anomalies, but it checks out.
The message format looks like this:
event: 0a6b...
data: {"foo": "bar", "bar": "foo"}
The response headers from the server seem correct as well:
HTTP/1.1 200
Cache-Control: private
Content-Encoding: gzip
Content-Type: text/event-stream;charset=UTF-8
Date: Sat, 07 Oct 2017 11:05:11 GMT
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
transfer-encoding: chunked
Connection: keep-alive
I do however wonder if the expires
header affects OkHttp in some way.
from oksse.
OkHttp respects the headers so it might be causing it to disconnect. But what you could do is to take any other URL feed that serves an SSE channel and check your code.
Try the feed we use for the tests: https://proxy.streamdata.io/https://api.myjson.com/bins/jixid
It only send one message but I should not close the channel if it does close it then sth is wrong on the configuration of the client
from oksse.
Oh, also I just saw the content comes gzip? That might cause issues, I remember we had some issues with it.
from oksse.
Thank you for the answers.
The source that you provided seems stable. No EOFExceptions occurred within the timeframe.
I will check back with our team and try to adjust our headers and encoding.
Il post the solution as soon as we find it for future reference.
from oksse.
Any news on this? Can I close the ticket?
from oksse.
Indeed.
Our server config. indicated that the connection should not be kept alive for more than a minute.
Additionally, we added a "keepAlive" message that is sendt to the client every x seconds.
In summary. This was a configuration error on the backend.
from oksse.
Related Issues (19)
- Spring SSE? HOT 1
- HTTPS Not secure problem HOT 3
- The library crashes on Android when closeSSEConnection() is called HOT 4
- Crash app when turn off network HOT 1
- StrictMode error: Explicit termination method 'response.body().close()' not called HOT 10
- Cannot add Accept: application/stream+json header HOT 4
- onMessage() callback not called when event starts with a comment HOT 4
- creating a release HOT 2
- getting SocketTimeout - curl works HOT 3
- Could not find com.github.heremaps:oksse:0.9.0 - > 0.9.0 build is failing HOT 6
- Missing description on what `onPreRetry` does
- Error in onPreRetry signature
- Could not find com.github.heremaps:oksse:0.9.0 - > 0.9.0 build is failing
- cannot resolve Request.Builder() HOT 1
- Question: No changes in 2+ years, should we consider moving to okhttp-sse instead? HOT 2
- Library Version with HTTP2 support doesn't appear to be published on jitpack HOT 15
- okhttp3.internal.connection.RealCall.timeoutEarlyExit
- Retrofit how to use
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 oksse.