You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that the real EventSource sets the TCP keepalive of the connection so it can idle for longer. I'm not sure if this can be set just on the server side.
I wonder how using sse.js impacts the hard problems with streams, namely knowing if you are still connected, and reconnecting automatically.
I am looking for a nice way to do GraphQL subscriptions over HTTP/2, and websockets seem too complex. Much simpler to return an event stream for each POST subscription and letting HTTP/2 multiplex them. Automatic reconnecting would be wonderful.
The text was updated successfully, but these errors were encountered:
sse.addEventListener("error",()=>{// as the docs say, this only fires if there is an error with the event, manual closing is handled by "abort"sse.stream();// try to re-open the stream});
this is as basic as it gets, create a simple module that will do this, maybe add a retry counter and a try/catch block in case the stream() fails to open.
Use sse.readyState and check if the state is not 2 before you re-do the connection
something like this, i don't think its such a big deal to create a reconnection functionality based on this.
I believe that the real EventSource sets the TCP keepalive of the connection so it can idle for longer. I'm not sure if this can be set just on the server side.
I wonder how using sse.js impacts the hard problems with streams, namely knowing if you are still connected, and reconnecting automatically.
I am looking for a nice way to do GraphQL subscriptions over HTTP/2, and websockets seem too complex. Much simpler to return an event stream for each POST subscription and letting HTTP/2 multiplex them. Automatic reconnecting would be wonderful.
The text was updated successfully, but these errors were encountered: