Skip to content

Commit

Permalink
feat(client): connectionParams can return undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Jun 23, 2021
1 parent dd28295 commit a543187
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/interfaces/client.clientoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Configuration used for the GraphQL over WebSocket client.

### connectionParams

`Optional` **connectionParams**: `Record`<string, unknown\> \| () => `Record`<string, unknown\> \| `Promise`<Record<string, unknown\>\>
`Optional` **connectionParams**: `Record`<string, unknown\> \| () => `undefined` \| `Record`<string, unknown\> \| `Promise`<undefined \| Record<string, unknown\>\>

Optional parameters, passed through the `payload` field with the `ConnectionInit` message,
that the client specifies when establishing a connection with the server. You can use this
Expand Down
7 changes: 5 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Disposable,
Message,
MessageType,
ConnectionInitMessage,
ConnectionAckMessage,
PingMessage,
PongMessage,
Expand Down Expand Up @@ -170,8 +171,10 @@ export interface ClientOptions {
* in the close event reason.
*/
connectionParams?:
| Record<string, unknown>
| (() => Promise<Record<string, unknown>> | Record<string, unknown>);
| ConnectionInitMessage['payload']
| (() =>
| Promise<ConnectionInitMessage['payload']>
| ConnectionInitMessage['payload']);
/**
* Controls when should the connection be established.
*
Expand Down

0 comments on commit a543187

Please sign in to comment.