Giter Club home page Giter Club logo

Comments (1)

eli-darkly avatar eli-darkly commented on June 10, 2024

Well, without knowing any more about the circumstances, I would say it's possible that it means just what it says: an operation timed out. There are two kinds of timeouts you can have with EventSource, and the duration for each of them is configurable:

  1. Connection timeout: if the server is just not responding to the connection attempt.
  2. Read timeout: if the connection seems to still be alive, but the server has not sent any data in a while.

The read timeout case is particularly tricky because under some circumstances, a streaming connection (not just for EventSource; for anything) can appear to still be open when really it has died, and there's no way to detect that except by noticing that no data has been received for a long time. So, it's common to add "heartbeat" behavior to the server that's providing the SSE stream: every so often (say 3 minutes) it writes a meaningless data item, or just a ":" comment line, to the stream simply so the client knows it's still alive. Then you would set the client's read timeout to some number greater than that (say 4 minutes).

In our experience, this is the best practice to deal with the kind of network unreliability I mentioned, so EventSource uses a read timeout by default. You can however set the read timeout to System.Threading.Timeout.Infinite to disable this.

If you have reason to believe that that's not what's happening, then I would need to know more about your use case, like what is generating the stream, how often does it produce data, how long does your client run before seeing the error - anything at all that you can tell me besides just the stacktrace.

from dotnet-eventsource.

Related Issues (20)

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.