Socket
Socket
Sign inDemoInstall

web3-stream-provider

Package Overview
Dependencies
9
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    web3-stream-provider

Utility for creating an Ethereum web3 provider that forwards payloads through a stream.


Version published
Weekly downloads
324
increased by143.61%
Maintainers
1
Install size
217 kB
Created
Weekly downloads
 

Readme

Source

web3-stream-provider

Utility for creating an Ethereum web3 provider that forwards payloads through a stream. Only works for async payloads.

For connecting to a remote eth rpc handler

const StreamProvider = require('web3-stream-provider')

var streamProvider = new StreamProvider()
var web3 = new Web3(streamProvider)

streamProvider.pipe(remoteRpcHandler).pipe(streamProvider)

For handling incoming rpc payloads

const handleRequestsFromStream = require('web3-stream-provider/handler')

handleRequestsFromStream(remoteStream, provider, /* optional */ onRequest, onResponse)

function onRequest(request){
  // can modify the request if needed
  console.log(arguments)
}

function onResponse(err, request, response){
  console.log(arguments)
}

Keywords

FAQs

Last updated on 24 Aug 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc