Switching realtime provider (removing Hocus Pocus)

Currently Cristal uses Hocus Pocus as the realtime provider (client + backend).

After experimenting with it, it seems like it has a considerable set of drawbacks for our use case. First of all, Hocus Pocus is specifically designed to be used inside TipTap, and this shows when you read the docs or check code examples.

  • Lots of synchronization errors that seemingly come from nowhere - we have a very basic server with almost no customization, same for the client. Yet synchronization with other clients very often fail without any error being shown, replacing the editor’s content for all realtime players with an empty text
  • There is a lack of correct typing for some parts of the library, notably events which are not typed at all. This is not a major issue but it’s still unfortunate for a library to require manual typing in a TypeScript project.
  • Recurring troubles with WebSocket which for some reason doesn’t work reliably - very often it stops working and I can’t figure out why. This may be a misconfiguration in Cristal but I can’t find what the problem could be given the very low amount of configuration we do.
  • Lack of configuration options - you can’t for instance configure the timeout for the client when trying to connect to the server, and the default is way too high for our need. The only way to do it is to create a WebSocketProvider ourselve, which comes with its own set of troubles.
  • Some events are confusing - there is no clear way to know when the initial connection to the server failed, only that it closed. Which makes code harder to write and read.

For all these reasons, and given we don’t have any specific need for the provider other than “just working” and a few configuration options, I think it would be best to look at alternatives to replace Hocus Pocus.

There are many options, the most interesting one for me would be LiveBlocks, which seems to be really mature, editor-agnostic (not specifically tailored to TipTap or anything else), with complete typing, and it’s used in many different products which means it should be pretty battled-tested.

Is LiveBlocks a free and open source software solution that is free to use? Pricing | Liveblocks doesn’t sound like it to me. It doesn’t seem useful for me to try to use a software that is only free for up to 50 monthly active users (unless I completely misunderstood the goals of this proposal).

1 Like

Right, they announced an open source server some time ago but it doesn’t look like their main focus anymore: [FEATURE_REQUEST] Self-hosting? · Issue #682 · liveblocks/liveblocks · GitHub

1 Like

Good point, from what I can see the pricing is for their own hosting offering.
The libraries themselves are licensed under Apache 2.0 liveblocks/LICENSE at main · liveblocks/liveblocks · GitHub

I wasn’t aware of that, thanks for pointing it out.

Another option that could be considered would be WebRTC, which is pretty standard, but the plugin (GitHub - yjs/y-webrtc: WebRTC Connector for Yjs) seems to not be very well maintained.

There’s also the WebSocket route with GitHub - yjs/y-websocket: Websocket Connector for Yjs and GitHub - yjs/y-websocket-server: A basic backend for y-websocket

Another option to consider would be https://partykit.io/

I think we need to have a more detail comparison matrix of the alternatives before making a choice.
With criterias like:

  • license
  • risk of becoming close source (or a very limited open core)
  • sustainability of the project (i.e., how likely maintained in the long term)
  • current support for Blocknote

Also, if you identified bugs with HP integration with Blockbnote, it might be interesting to raise them to the maintainers. If we are lucky, they might fix them.

1 Like

Absolutely, this topic was mainly focused on “do we remove Hocus Pocus?”
Choosing a new provider will be another subject.

A criterion I’m missing is the ability to use XWiki as realtime backend. As we want to integrate the editor in XWiki, too, it would be quite a showstopper if realtime synchronization required running a separate server.

Does XWiki expose a Y.js-compatible server? I’m only seeing Hocus Pocus in the codebase…

It does not.

For BlockNote integration, initially we’ll be using a separate server, but on the long run we’ll have to think about how to “embed” (or implement) this synchronization backend in XWiki.