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

push-mux

v1.0.7

Published

multiplexed-rpc (compat with [muxrpc](https://github.com/ssbc/muxrpc)) with credit based flow control.

Downloads

17

Readme

push-mux

multiplexed-rpc (compat with muxrpc) with credit based flow control.

background

I had originally wanted to have muxrpc support back pressure, but at the time it was too hard and ended up moving forward without it. This caused various problems (such as using way too much resources which is what you'd expect from no backpressure!), and was met with various work arounds. Instead of building in pull-streams, I made a very simple stream primitive (that i called "weird streams" so you knew it was a bad idea). With this we implemented packet-stream, which is wrapped by muxrpc.

Now it's 2018 and I'm trying to get secure-scuttlebutt replication working very efficiently, so need back pressure. I revisited weird-streams and thought about how they could be made to have back pressure, resulting in push-stream which turned out very good. (push streams seem to take a little more code to implement than pull-streams) but they also seem easier to think about. (and less async, which tended to be the hard part!)

back pressure

Inspiration for this thing more or less came from martin sustrik's blog post TCP and heartbeats, which outlines a simple flow control scheme called "credit based flow control", (not to be confused with control flow)

In particular, he says that there has been a real low level protocol that implements multiplexing with back pressure (SCTP), but the world is stuck with TCP. so we end up reimplementing tcp on top of tcp.

What happens is that developers are not aware of SCTP. That admins are not fond of having non-TCP packets on the network. That firewalls are often configured to discard anything other than TCP or UDP. That NAT solutions sold by various vendors are not designed to work with SCTP. And so on, and so on.

In short, although designers of the Internet cleverly split the network layer (IP) from transport layer (TCP/UDP) to allow different transports for users with different QoS requirements, in reality — propelled by actions of multitude of a-bit-less-clever developers — the Internet stack have gradually fossilised, until, by now, there is no realistic chance of any new L4 protocol gaining considerable traction.

So, while re-implementing TCP functionality on top of TCP may seem like a silly engineering solution when you look at it with narrow mindset, once you accept that Internet stack is formed by layers of gradually fossilising protocols, it may actually be the correct solution, one that takes political reality into consideration as well as technical details.

Indeed! and while nanomsg is mainly concerned with applications running in a data center, and where just using lots of TCP connections directly is a reasonable option, and that multiplexing isn't usually actually worth it

I am more interested in p2p protocols were we must take any opportunity to connect two peers we can get - this means operating over connections that have a lot more overhead: websockets, webrtc, tor, and even if our connections are TCP they are over the public internet and theirfore require encryption, which adds several roundtrips to the handshake!

Also, all these other protocol layers we need to work with have their own quirks - adding another multiplexing layer allows us to work with one simple thing, as Martin Sustrik says:

And hopefully, at some point, when everbody have already migrated to some future TCP-on-top-of-TCP-on-top-of-TCP-on-top-of-TCP-on-top-of-TCP protocol, we can create a shotcut and get rid of those good-for-nothing intermediate layers.

License

MIT