Socket
Socket
Sign inDemoInstall

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

Proxy hyperswarm connections over websockets with auto-reconnect logic


Version published
Maintainers
1
Created
Source

hyperswarm-proxy-ws

Proxy hyperswarm connections over websockets with auto-reconnect logic

npm -s hyperswarm-proxy-ws

Example


const HyperswarmServer = require('hyperswarm-proxy-ws/server')

// Initialize the proxy server
// Also specify any options for hyperswarm here
// https://github.com/hyperswarm/hyperswarm
const server = new HyperswarmServer()

// Start listening on clients via websocket protocol
server.listen(3472)


const HyperswarmClient = require('hyperswarm-proxy-ws/client')

// Initialize a proxied hyperswarm
// Also specify any options for hyperswarm-proxy client
// https://github.com/RangerMauve/hyperswarm-proxy#client
const swarm = new HyperswarmClient({
  // Specify a list of proxy servers available to connect to
	proxy: ['ws://127.0.0.1:3472']
})

// Same as with hyperswarm
swarm.on('connection', (connection, info) => {
	const stream = getSomeStream(info.topic)

	// Pipe the data somewhere
	// E.G. hyperdrive.replicate()
	connection.pipe(stream).pipe(connection)
})

swarm.join(topic)

swarm.leave(topic)

Keywords

FAQs

Package last updated on 03 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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