npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seneca-zyre-transport

v1.0.8

Published

![Seneca](http://senecajs.org/files/assets/seneca-logo.png)<br/> proximity p2p transport plugin using zyre.js

Downloads

13

Readme

Seneca proximity p2p transport plugin using zyre.js

seneca-zyre-transport

Note: This is broadcast transport. All subscribed micro-services receive all messages. Hoverver responses are send directly back to the caller, contributions that incorperate seneca-balance-client as a dependency are welcome, having to include pins/load balance peers doesn't really fit my use case. So if a response/done call contains the property observed$: true, the message id isn't removed from the lru cache (in default seneca-transport package) and the calling 'act' can recieve responses from multiple seneca peers that have the pattern. Not sure if leaving the message id in the cache might cause other issues. Next will be adding pattern so 'list' can be called on the collective p2p mesh, if we know how many responses to expect the the calling 'act' can then remove the message id from the the cache when they are all recieved. (my library that wraps seneca uses rxjs so it makes sense to have responses comming back as a stream) if you have experience with seneca and this approach doesn't make sense for some reason please open an issue, I've only just begun to explore the callback hell which is seneca's internals and have barely a clue what's cuttin in there

Seneca compatibility

Tested on 3.5

Install

To install, simply use npm.


npm install seneca --save
npm install seneca-zyre-transport --save

Quick Example

examples can be found in expamples folder

Seneca({
  tag: 'hex-service', transport: {
    zyre: {
      ...conf.config2b,
      name: "service"
    }
  }
})
  .test('print')
  .use(ztrans)
  .client({ type: 'zyre' })
  .listen({ type: 'zyre' })
  .ready(function () {
    var seneca = this
    this.add('role:color,format:hex', (msg, done) => {
      done(null, {
        color: 'hex string -- this is the result',
        format: 'hex'
      })
    })
    console.log('hex', seneca.id)
  })
Seneca({
  tag: 'client', log: 'silent'
})
.test('print')
  .use(ztrans, {
    zyre: {
      ...conf.config1b,
      name: "client"
    }
  })
  .client({ type: 'zyre' })
  .listen({ type: 'zyre' })
  .ready(function () {

    setInterval(() => {
      this.act(
        {
          role: 'color',
          format: 'hex',
          color: 'red'
        },
        function (err, out) {
          console.log(err && err.message || out.color)
          // this.close()
        })
    }, 5000)

  })