Socket
Socket
Sign inDemoInstall

json-rpc-middleware-stream

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-rpc-middleware-stream - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

12

engineStream.js

@@ -7,5 +7,11 @@ const DuplexStream = require('readable-stream').Duplex

if (!engine) throw new Error('Missing engine parameter!')
const stream = new DuplexStream({ objectMode: true, read, write })
// forward notifications
if (engine.on) {
engine.on('notification', (message) => {
stream.push(message)
})
}
return stream
return new DuplexStream({ objectMode: true, read, write })
function read () {

@@ -20,2 +26,2 @@ return false

}
}
}
{
"name": "json-rpc-middleware-stream",
"version": "2.0.0",
"version": "2.1.0",
"description": "",

@@ -13,3 +13,3 @@ "main": "index.js",

"ethjs-query": "^0.2.9",
"json-rpc-engine": "^3.0.1",
"json-rpc-engine": "^3.8.0",
"readable-stream": "^2.3.3",

@@ -16,0 +16,0 @@ "safe-event-emitter": "^1.0.1"

@@ -104,1 +104,21 @@ const test = require('tape')

})
test('server notification in stream', (t) => {
const engine = new RpcEngine()
const stream = createEngineStream({ engine })
const notif = { jsonrpc: '2.0', method: 'test_notif' }
// listen for incomming requests
stream.once('data', (_notif) => {
t.deepEqual(notif, _notif, 'got the expected notification')
t.end()
})
stream.on('error', (err) => {
t.fail(error.message)
})
engine.emit('notification', notif)
})
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