Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
seneca-transport
Advanced tools
This plugin allows you to execute Seneca actions in separate Seneca processes. The default transport mechanism is HTTP. Redis publish-subscribe is also built-in.
This plugin provides the implementation for the listen, client, and proxy convenience methods on the Seneca object. It is included as a dependent module of the Seneca module.
You can provide your own transport mechanisms by overriding the transport action patterns (see below).
If you're using this module, feel free to contact me on Twitter if you have any questions! :) @rjrodger
Current Version: 0.2.0
Tested on: Node 0.10.29, Seneca 0.5.18
First, define a service (this is just a Seneca plugin):
module.exports = function() {
this.add( 'foo:1', function(args,done){done(null,{s:'1-'+args.bar})} )
this.add( 'foo:2', function(args,done){done(null,{s:'2-'+args.bar})} )
}
Start the service:
require('seneca')()
.use('foo')
.listen()
And talk to it:
require('seneca')()
.listen()
.ready(function(){
this.act('foo:1,bar:A',function(err,out){console.log(out)})
this.act('foo:2,bar:B',function(err,out){console.log(out)})
})
And this prints:
1-A
2-B
To run this example, try in one terminal
node test/service-foo.js
and in another:
node test/client-foo.js
This module is included in the standard Seneca module, so install using that:
npm install seneca
Starts listening for actions. The type argument specifies the transport mechanism. Current built-ins are direct (which is HTTP), and pubsub (which is Redis).
Create a Seneca instance that sends actions to a remote service. The type argument specifies the transport mechanism.
These patterns are called by the primary action patterns. Add your own for additional transport mechanisms.
These all take additional configuration arguments, which are passed through from the primary actions:
If you only want to transport certain action patterns, use the pin argument to pick these out. See the test/client-pubsub-foo.js and test/service-pubsub-foo.js files for an example.
To see what this plugin is doing, try:
node your-app.js --seneca.log=plugin:transport
To skip the action logs, use:
node your-app.js --seneca.log=type:plugin,plugin:transport
For more on logging, see the seneca logging example.
This module itself does not contain any direct reference to seneca, as it is a seneca dependency. However, seneca is needed to test it, so the test script will perform an npm install seneca (if needed). This is not saved to package.json however.
npm test
FAQs
Seneca transport
The npm package seneca-transport receives a total of 6,568 weekly downloads. As such, seneca-transport popularity was classified as popular.
We found that seneca-transport demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.