Skip to content

Commit

Permalink
Fix WS clientConfig types and clarify docs (#3566)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio authored Jun 6, 2020
1 parent 98d7df6 commit 076fd46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion docs/include_package-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ Configuration
authorization: 'Basic username:password'
},
// Useful if requests result are large
clientConfig: {
// Useful if requests are large
maxReceivedFrameSize: 100000000, // bytes - default: 1MiB
maxReceivedMessageSize: 100000000, // bytes - default: 8MiB
// Useful to keep a connection alive
keepalive: true,
keepaliveInterval: 60000 // ms
},
// Enable auto reconnection
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-core-helpers/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export interface WebsocketProviderOptions {
reconnectDelay?: number;
headers?: any;
protocol?: string;
clientConfig?: string;
clientConfig?: object;
requestOptions?: any;
origin?: string;
reconnect?: ReconnectOptions;
Expand Down
12 changes: 7 additions & 5 deletions packages/web3-providers-ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ var options = {
authorization: 'Basic username:password'
},

// Useful if requests are large
clientConfig: {
// Useful if requests are large
maxReceivedFrameSize: 100000000, // bytes - default: 1MiB
maxReceivedMessageSize: 100000000, // bytes - default: 8MiB

// Useful to keep a connection alive
keepalive: true,
keepaliveInterval: 60000 // ms
},

// Enable auto reconnection
Expand All @@ -57,12 +61,10 @@ var options = {
};

var ws = new Web3WsProvider('ws://localhost:8546', options);

(Additional client config options can be found [here][1])

[1]: https://github.com/web3-js/WebSocket-Node/blob/polyfill/globalThis/docs/WebSocketClient.md
```

Additional client config options can be found [here](https://github.com/theturtle32/WebSocket-Node/blob/v1.0.31/docs/WebSocketClient.md#client-config-options).

## Types

All the TypeScript typings are placed in the `types` folder.
Expand Down

0 comments on commit 076fd46

Please sign in to comment.