Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

web3-providers-ws

Package Overview
Dependencies
Maintainers
1
Versions
454
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-providers-ws - npm Package Compare versions

Comparing version 1.0.0-beta.34 to 1.0.0-beta.35

4

package.json
{
"name": "web3-providers-ws",
"namespace": "ethereum",
"version": "1.0.0-beta.34",
"version": "1.0.0-beta.35",
"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.34",
"web3-core-helpers": "1.0.0-beta.35",
"websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible"
}
}

@@ -31,3 +31,3 @@ /*

var parseURL = null;
if (typeof window !== 'undefined') {
if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') {
Ws = window.WebSocket;

@@ -43,4 +43,14 @@ _btoa = btoa;

};
// Web3 supports Node.js 5, so we need to use the legacy URL API
parseURL = require('url').parse;
var url = require('url');
if (url.URL) {
// Use the new Node 6+ API for parsing URLs that supports username/password
var newURL = url.URL;
parseURL = function(url) {
return new newURL(url);
};
}
else {
// Web3 supports Node.js 5, so fall back to the legacy URL API if necessary
parseURL = require('url').parse;
}
}

@@ -65,2 +75,3 @@ // Default connection ws://localhost:8546

var headers = options.headers || {};
var protocol = options.protocol || undefined;
if (parsedURL.username && parsedURL.password) {

@@ -70,3 +81,3 @@ headers.authorization = 'Basic ' + _btoa(parsedURL.username + ':' + parsedURL.password);

this.connection = new Ws(url, undefined, undefined, headers);
this.connection = new Ws(url, protocol, undefined, headers);

@@ -109,2 +120,10 @@ this.addDefaultEvents();

};
// make property `connected` which will return the current connection status
Object.defineProperty(this, 'connected', {
get: function () {
return this.connection && this.connection.readyState === this.connection.OPEN;
},
enumerable: true,
});
};

@@ -111,0 +130,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc