Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omnistreams vs muxado/yamux #2

Open
anderspitman opened this issue Aug 17, 2024 · 0 comments
Open

omnistreams vs muxado/yamux #2

anderspitman opened this issue Aug 17, 2024 · 0 comments

Comments

@anderspitman
Copy link
Member

A key feature of omnistreams vs something like muxado or yamux is that we assume we're running on top of a frame-oriented transport, instead of a stream-oriented one. This makes it simple and clean to implement things like streams of datagrams or discrete JSON events, in addition to byte streams. Otherwise you would have to add your own framing on top. If your underlying transport is something like TCP this isn't that big of a deal, since you'd need to anyway. But when running on WebSockets, you're building

a frame transport (datagrams/events) on top of
a stream transport (muxado/yamux) on top of
a frame transport (WebSocket) on top of
a stream transport (TCP) on top of
a "frame" transport (IP)

omnistreams lets you invert the last two so you end up with

a frame transport (omnistreams) on top of
a frame transport (WebSocket) on top of
a stream transport (TCP) on top of
a "frame" transport (IP)

Not only have we cut out an entire layer, it also has better alignment since both omnistreams and WebSocket are frame oriented.

Note that if you want to run byte streams on top of omnistreams you're back to this:

a stream transport (omnistreams) on top of
a frame transport (WebSocket) on top of
a stream transport (TCP) on top of
a "frame" transport (IP)

You've still sort of cut out a layer since omnistreams natively supports byte streams, but technically the conversion between frames and byte streams has to be done, so that layer is really still there, it's just abstracted away for you.

I was originally using muxado for Waygate, by simply using this to turn WebSockets into streams. It worked well for me, but there are some scary caveats that I still don't fully understand on that page. I originally started moving from muxado to omnistreams because I wanted datagram support and I couldn't bring myself to add another layer on top, so here we are.

@anderspitman anderspitman changed the title Potential problems with large messages omnistreams vs muxado/yamux Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant