Repository navigation
feat(client): handle timeout in SSE link - #6214
Conversation
|
π Deployed to the trpc-pr-6214 environment in trpc-sse-and-websockets
|
|
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
commit: |
β¦-timeout-inact # Conflicts: # packages/tests/server/httpSubscriptionLink.test.ts
| EventSource: EventSourceLike.AnyConstructor; | ||
| } | ||
|
|
||
| async function withTimeout<T>(opts: { |
There was a problem hiding this comment.
Would this be better as its own link maybe? timeoutLink feels like a useful primitive and might simplify things?
There was a problem hiding this comment.
Since it seems to be an issue with all browsers I kinda want it built-in
It's enough to do kill -9 on a server for EventSource to hang in Chrome
There was a problem hiding this comment.
Fair, MR looks great, happy to approve whenever you say its ready
| const result = await promise; | ||
|
|
||
| if (value.done) { | ||
| // console.debug('result', result, 'done', result.done); |
| }); | ||
| ``` | ||
|
|
||
| When configuring both client timeout and server ping, ensure that: |
There was a problem hiding this comment.
could this be a validation step at runtime?
# Conflicts: # packages/server/src/adapters/node-http/nodeHTTPRequestHandler.ts # packages/server/src/unstable-core-do-not-import/stream/utils/withPing.ts
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Closes #
π― Changes
Adds ability to timeout an SSE connection without losing tracked events.
From testing, browsers seem really bad at keeping track of a server that e.g. gets killed.
Should I add a default maybe?
Thinking something like default timeout 30s, default ping every 15s