Description
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
The documentation for graphql-ws describes that the return value of onConnect will behave as it does with subscriptions-transport-ws, where the value is attached to context for usage in context() etc - however, this is not the case.
The return value of onConnect for graphql-ws is actually returned to the client as the payload for connection_ack.
Describe the solution you'd like
It is unclear to me which is more correct, but at the moment, the documentation and the behavior are out of sync in a way that results in confused developers (me) at best, or, at worst, returning data intended for server-side usage to the client.
I'd like to see a version of onConnect that allows for both - returning a tuple causes the first value to be returned as connection_ack payload and the second value attached to context.
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
- The documentation is incorrect with regard to actual behavior.
- We cannot attach any data at connection time to context for websocket connections.