Skip to content

multiplexing

Pre-release
Pre-release
Compare
Choose a tag to compare
@janthurau janthurau released this 28 Feb 17:09
· 329 commits to main since this release
v2.0.0-alpha.0
c0dd61b

This is the first alpha release introducing multiplexing support.

The status is still a bit early, but I already wanted to gather as much feedback as possible and find potential testers in the community. I currently do not have a bigger project where I can test this, so if you can use multiplexing in your project and are willing to give the current implementation a try, this would be much appreciated and helps to get this merged soon.

On the frontend side, all connection logic has been split to a new ‘HocuspocusProviderWebsocket’, which needs to be passed to your HocuspocusProvider(s). So if you want to synchronize three documents, you’ll create one HocuspocusProviderWebsocket and three HocuspocusProvider, which gets passed the websocket (webSocket param). Authentication works per document, so the URL has to be passed to the HocuspocusProviderWebsocket, tokens to the provider related with the document. A working example can be found in playground/frontend/src/pages/Index.vue. Provider events are filtered by documentName, so the frontend shouldnt require further changes. Same on the backend, note that internally we’re spawning different Connection instances that each handle one document connection (through the same websocket). If you are somehow parsing the websocket messages yourself, please note that the protocol has changed and now includes the documentName at the first segment of the message.

You can find the PR here for details: #484

If you need any help, feel free to ping me (@janthurau) on Discord or send me a direct message.