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

hyperswarm-proxy-ws

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperswarm-proxy-ws - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

14

client.js

@@ -6,3 +6,3 @@ const HyperswarmProxyClient = require('hyperswarm-proxy/client')

const LOCAL_PROXY = `ws://localhost:${DEFAULT_PORT}`
const DEFAULT_PROXY = LOCAL_PROXY
const DEFAULT_PROXY = [LOCAL_PROXY]
const DEFAULT_RECONNECT_DELAY = 1000

@@ -16,5 +16,8 @@

this.proxy = proxy
this.reconnectDelay = reconnectDelay
this.proxy = null
this._urls = typeof proxy === 'string' ? [proxy] : proxy
this._urlIndex = 0
this.reconnect()

@@ -24,2 +27,4 @@ }

reconnect () {
this._nextUrl();
const localSocket = websocket(LOCAL_PROXY)

@@ -49,4 +54,9 @@

}
_nextUrl() {
this.proxy = this._urls[this._urlIndex++ % this._urls.length]
return this.proxy
}
}
module.exports = HyperswarmProxyWSClient

2

package.json
{
"name": "hyperswarm-proxy-ws",
"version": "1.0.1",
"version": "1.1.0",
"description": "Proxy hyperswarm connections over websockets with auto-reconnect logic",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -29,4 +29,4 @@ # hyperswarm-proxy-ws

const swarm = new HyperswarmClient({
// Specify the proxy server to connect to
proxy: 'ws://127.0.0.1:3472'
// Specify a list of proxy servers available to connect to
proxy: ['ws://127.0.0.1:3472']
})

@@ -33,0 +33,0 @@

@@ -14,3 +14,3 @@ const hyperswarm = require('@hyperswarm/network')

t.plan(4)
t.plan(5)

@@ -31,3 +31,6 @@ try {

const swarm = new Client({
proxy
proxy: [
'ws://localhost:4000', // wrong url
proxy,
]
})

@@ -72,2 +75,4 @@

t.equal(swarm.proxy, proxy, 'should use the working proxy')
t.deepEqual(info.peer.topic, TEST_TOPIC, 'got connection in client')

@@ -74,0 +79,0 @@ connection.on('data', () => {

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