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've noticed that text/event-stream responses in FireFox 127.0b9 (64-bit) eventually end up with Error in input stream error. This doesn't happen in Safari or Google Chrome. I've tested this by directly sending a fetch request with JavaScript, using URQL and through GraphiQL.
This seems to have to do with the timing for keepalive comments (it appears to be 10-12 seconds). If I artificially send comments from a resolver at 5 second intervals, the connection stays open in FireFox. If I increase the keepalive comment interval to 7.5 seconds or above, I eventually end up with an Error in input stream.
It would be nice to have a keepalive interval option on HandlerOptions.
I forked the repo and added a keepalive option to the HandlerOptions interface and used it where the pingeris created. However, it doesn't look like a pinger is being created for the request so I'm not sure where the keepalive comments I'm getting are even sent from.
With a little guidance I may be able to fix this and submit a pull request.
I've attached some screenshots and example code.
Screenshots
Example Code
importhttpfrom"http";import{createHandler}from"graphql-sse/lib/use/http";import{makeExecutableSchema}from"@graphql-tools/schema";import{Repeater}from"@repeaterjs/repeater";(async()=>{constschema=makeExecutableSchema({typeDefs: ` type Query { hello: String } type Subscription { wait: Boolean } `,resolvers: {Query: {hello(){return"Hello.";},},Subscription: {wait: {subscribe(){returnnewRepeater((push)=>{push({wait: true});});},},},},});consthandler=createHandler({ schema,context: (req)=>({ req })});constserver=http.createServer(async(req,res)=>{try{awaithandler(req,res);}catch(err){console.error(err);res.writeHead(500).end();}});server.listen(8000);console.log("Listening to port 8000");})();
Hey hey, thanks for reporting and sorry for the delay! I've been very busy ahead of the upcoming GraphQL Conf 2024. A PR with an adjusted keepalive default, or even configurable one, would be very welcome and much appreciated! No pressure though; if not, I'll be revisiting this issue after the conf.
I've noticed that
text/event-stream
responses inFireFox 127.0b9 (64-bit)
eventually end up withError in input stream
error. This doesn't happen inSafari
orGoogle Chrome
. I've tested this by directly sending a fetch request with JavaScript, using URQL and through GraphiQL.This seems to have to do with the timing for
keepalive
comments (it appears to be 10-12 seconds). If I artificially send comments from a resolver at 5 second intervals, the connection stays open in FireFox. If I increase thekeepalive
comment interval to 7.5 seconds or above, I eventually end up with anError in input stream
.It would be nice to have a
keepalive
interval option on HandlerOptions.I forked the repo and added a
keepalive
option to theHandlerOptions
interface and used it where thepinger
is created. However, it doesn't look like apinger
is being created for the request so I'm not sure where thekeepalive
comments I'm getting are even sent from.With a little guidance I may be able to fix this and submit a pull request.
I've attached some screenshots and example code.
Screenshots
Example Code
Modified Resolver
The text was updated successfully, but these errors were encountered: