sgqlc icon indicating copy to clipboard operation
sgqlc copied to clipboard

Support for authentication in WebSocket connections

Open artran opened this issue 5 years ago • 2 comments

Hi, I'm using this against an endpoint that enforces authorisation in all requests. This is straightforward in the plain HTTP connections but WebSocket works differently - see here for example: https://www.apollographql.com/docs/graphql-subscriptions/authentication/

It would be really helpful if the WebSocketEndpoint constructor allowed a dictionary to be passed that could be used in the connection_init message.

I have forked the project and implemented this (with a test) so if you think it would be useful I can create a pull request for you.

Cheers, Ray

artran avatar Feb 04 '20 10:02 artran

sure, send a patch. I didn't write the websocket myself, I thought it was all handled in the ws_options.

barbieri avatar Feb 04 '20 12:02 barbieri

I initially thought it would be that way too. Pull request is now added.

Thanks.

artran avatar Feb 04 '20 12:02 artran