Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WS clientConfig type and clarify docs #3566

Merged
merged 1 commit into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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