web3-providers-ws
Advanced tools
Comparing version 1.0.0-beta.35 to 1.0.0-beta.36
{ | ||
"name": "web3-providers-ws", | ||
"namespace": "ethereum", | ||
"version": "1.0.0-beta.35", | ||
"version": "1.0.0-beta.36", | ||
"description": "Module to handle web3 RPC connections over WebSockets.", | ||
@@ -11,5 +11,5 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-ws", | ||
"underscore": "1.8.3", | ||
"web3-core-helpers": "1.0.0-beta.35", | ||
"web3-core-helpers": "1.0.0-beta.36", | ||
"websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible" | ||
} | ||
} |
@@ -32,3 +32,5 @@ /* | ||
if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') { | ||
Ws = window.WebSocket; | ||
Ws = function(url, protocols) { | ||
return new window.WebSocket(url, protocols); | ||
}; | ||
_btoa = btoa; | ||
@@ -79,4 +81,12 @@ parseURL = function(url) { | ||
this.connection = new Ws(url, protocol, undefined, headers); | ||
// Allow a custom client configuration | ||
var clientConfig = options.clientConfig || 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.addDefaultEvents(); | ||
@@ -105,3 +115,3 @@ | ||
// notification | ||
if(!id && result.method.indexOf('_subscription') !== -1) { | ||
if(!id && result && result.method && result.method.indexOf('_subscription') !== -1) { | ||
_this.notificationCallbacks.forEach(function(callback){ | ||
@@ -388,2 +398,8 @@ if(_.isFunction(callback)) | ||
WebsocketProvider.prototype.disconnect = function () { | ||
if (this.connection) { | ||
this.connection.close(); | ||
} | ||
}; | ||
module.exports = WebsocketProvider; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12612
318
+ Addedweb3-core-helpers@1.0.0-beta.36(transitive)
+ Addedweb3-eth-iban@1.0.0-beta.36(transitive)
+ Addedweb3-utils@1.0.0-beta.36(transitive)
- Removedweb3-core-helpers@1.0.0-beta.35(transitive)
- Removedweb3-eth-iban@1.0.0-beta.35(transitive)
- Removedweb3-utils@1.0.0-beta.35(transitive)