subscription: Allow to multiplex subsequent payloads between events #54
Replies: 2 comments 1 reply
-
Just want to point out that this is also a problem that exists for subscriptions without defer/stream. If the resolvers for a subscription event take longer than it takes to produce new events, the server will end up buffering. But that doesn't necessarily mean we shouldn't address this issue. @IvanGoncharov is your recommendation that we don't specify the order and it instead becomes part of the transport layer to handle the multiplexing? |
Beta Was this translation helpful? Give feedback.
-
Marking this as |
Beta Was this translation helpful? Give feedback.
-
In the current proposal for sending new subscriptions, events are blocked until all subsequent payloads of the last event.
That means a combination of "slow deferred fields" and fast "events" wouldn't work.
Example:
If there are 10ms intervals between events but 100ms time for resolving deferred fields.
With current proposal sequence will look like so:
So it forces the server to buffer events and release them in bursts.
I think transport protocol should be allowed to multiplex subsequent payloads between events, like so:
It's trivial to do by attaching the event number to initial and subsequent payloads.
In JS terms result should be:
AsyncIteratable<AsyncIteratable<ExecutionResult>>
The inner iterable is for the event's initial and subsequent payloads, and the outer iterable is for subscribing events.
Beta Was this translation helpful? Give feedback.
All reactions