Socket
Socket
Sign inDemoInstall

web3-providers-ws

Package Overview
Dependencies
Maintainers
2
Versions
416
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.2.0 to 1.2.1

11

package.json
{
"name": "web3-providers-ws",
"version": "1.2.0",
"version": "1.2.1",
"description": "Module to handle web3 RPC connections over WebSockets.",

@@ -8,13 +8,10 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ws",

"engines": {
"node": ">=8.0.0 <=11.15.0"
"node": ">=8.0.0"
},
"main": "src/index.js",
"scripts": {
"preinstall": "rm -rf node_modules/websocket/.git"
},
"dependencies": {
"underscore": "1.9.1",
"web3-core-helpers": "1.2.0",
"websocket": "github:frozeman/WebSocket-Node#browserifyCompatible"
"web3-core-helpers": "1.2.1",
"websocket": "github:web3-js/WebSocket-Node#polyfill/globalThis"
}
}

@@ -27,18 +27,11 @@ /*

var errors = require('web3-core-helpers').errors;
var Ws = require('websocket').w3cwebsocket;
var Ws = null;
var isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
var _btoa = null;
var parseURL = null;
if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') {
Ws = function(url, protocols) {
return new window.WebSocket(url, protocols);
};
_btoa = btoa;
parseURL = function(url) {
return new URL(url);
};
} else {
Ws = require('websocket').w3cwebsocket;
if (isNode) {
_btoa = function(str) {
return Buffer.from(str).toString('base64');
return Buffer.from(str).toString('base64');
};

@@ -57,2 +50,7 @@ var url = require('url');

}
} else {
_btoa = btoa;
parseURL = function(url) {
return new URL(url);
};
}

@@ -65,2 +63,6 @@ // Default connection ws://localhost:8546

var WebsocketProvider = function WebsocketProvider(url, options) {
if (!Ws) {
throw new Error('websocket is not available');
}
var _this = this;

@@ -85,2 +87,6 @@ this.responseCallbacks = {};

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;

@@ -92,3 +98,3 @@ // When all node core implementations that do not have the

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

@@ -95,0 +101,0 @@ this.addDefaultEvents();

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