I thought this was interesting-- an abstraction layer for real time frameworks; it even supports binary encoding.
I remember a few months ago I was having a hard time finding a real time framework to power my collaborative drawing app (WIP - almost done), now it seems their are quite a number of them. I’m working on a reference collection so others can find them without searching for 2 weeks like I did (WIP).
I haven’t gone so far as to see how well Yjs integrates with primus, but I thought it was worth sharing
Primus, the creator god of transformers but now also known as universal wrapper for real-time frameworks. There are a lot of real-time frameworks available for Node.js and they all have different opinions on how real-time should be done. Primus provides a common low level interface to communicate in real-time using various real-time frameworks.
Advantages
- Effortless switching between real-time frameworks by changing one single line of code. No more API rewrites needed when your project requirements change, the framework gets abandoned or simply breaks down.
- Built-in reconnect, it just works. The reconnect is controlled by a randomised exponential back-off algorithm to reduce server stress.
- Offline detection, Primus is smart enough to detect when users drop their internet connection (switching WIFI points/cell towers for example) and reconnects when they are back online.
- Automatically encodes and decodes messages using custom parsers. Can be easily switched for binary encoding for example.
- A clean, stream-compatible interface for the client and server. You can just
stream#pipe
data around. In addition to that, the client works on Node.js as well, write once, run it everywhere.- Fixes various of bugs in the supported frameworks and additional stability patches to improve real-time communication.
- Comes with an amazing plugin interface to keep the core library as fast and lean as possible while still allowing the server and the client to be extended.
- Last but not least, Primus is built with love, passion and dedication to the real-time web.