GithubHelp home page GithubHelp logo

Comments (7)

marcelpinto avatar marcelpinto commented on August 14, 2024

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.

marcel-eggum avatar marcel-eggum commented on August 14, 2024

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.

marcelpinto avatar marcelpinto commented on August 14, 2024

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.

marcelpinto avatar marcelpinto commented on August 14, 2024

Oh, also I just saw the content comes gzip? That might cause issues, I remember we had some issues with it.

from oksse.

marcel-eggum avatar marcel-eggum commented on August 14, 2024

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.

marcelpinto avatar marcelpinto commented on August 14, 2024

Any news on this? Can I close the ticket?

from oksse.

marcel-eggum avatar marcel-eggum commented on August 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.