Skip to content

Commit

Permalink
Merge pull request #2979 from AsyncLegs/ws-agent-support
Browse files Browse the repository at this point in the history
requestOptions support added
  • Loading branch information
nivida authored Jul 31, 2019
2 parents 978ee0a + 960cd9e commit fe269fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/web3-providers-ws/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ var WebsocketProvider = function WebsocketProvider(url, options) {

// Allow a custom client configuration
var clientConfig = options.clientConfig || undefined;

// Allow a custom request options
// https://github.com/theturtle32/WebSocket-Node/blob/master/docs/WebSocketClient.md#connectrequesturl-requestedprotocols-origin-headers-requestoptions
var requestOptions = options.requestOptions || undefined;

// When all node core implementations that do not have the
// WHATWG compatible URL parser go out of service this line can be removed.
if (parsedURL.auth) {
headers.authorization = 'Basic ' + _btoa(parsedURL.auth);
}
this.connection = new Ws(url, protocol, undefined, headers, undefined, clientConfig);
this.connection = new Ws(url, protocol, undefined, headers, requestOptions, clientConfig);

this.addDefaultEvents();

Expand Down

0 comments on commit fe269fb

Please sign in to comment.