enisdenjo / graphql-ws

Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
https://the-guild.dev/graphql/ws
MIT License
1.75k stars 162 forks source link

allow to provide a third additional argument for a custom WebSocket implementation #579

Closed EmrysMyrddin closed 2 months ago

EmrysMyrddin commented 2 months ago

This PR aims to allow for more customization of the WebSocket class used by the client to establish connection.

When use on Node, one will probably want to use ws package as the WebSocket implementation. But currently, the API doesn't allow to pass any additional options to the WebSocket constructor.

This PR adds an option webSocketOpts that will be passed as a third argument to WebSocket constructor when a custom implementation has been provided.