Hi all,
Currently, the configuration of real-time in Cristal is as follows:
- check for the presence of a
realtimeURLkey in the current configuration - if the key is not found, real-time is not initialized (e.g., when opening an editor)
- if the key is found, a realtime connector is initialized:
- using
TiptapCollabProviderfor Tiptap - using
HocuspocusProviderfor Blocknote
The realtimeURL is currently targeting an HocuspocusServer.
But, when connecting Cristal to an XWiki backend, we’d like to use the soon-to-be-integrated Yjs real-time endpoint (see https://github.com/xwiki/xwiki-platform/pull/4361).
Therefore, we’ll need to adapt the selected real-time connector to the configuration.
Note: the proposal below is only for Blocknote as Tiptap is expected to be deprecated anytime soon.
Option 1: explicit configuration
Introduce an optional realtimeHint (with a default to the existing hocuspocus connector). When the hint is defined, the a connector is resolved based on he provided hint.
Of course, the realtimeURL needs to be adjusted when the realtimeHint is changed.
Option 1.1: flat
Keep the current format where all configuration keys are at the same depth level.
Since realtimeHint is optional, this is not a breaking change.
{
"XWiki": {
"realtimeURL": "https://localhost:8093/collaboration",
"realtimeHint": "xwiki"
}
}
Option 1.1: nested
The real-time values are nested below a root realtime key.
This is a breaking change, but I believe this is making the configuration easier to read.
{
"XWiki": {
"realtime": {
"url": "https://localhost:8093/collaboration",
"hint": "xwiki"
}
}
}
Option 1.2: nested + backward compatibility
Same as option 1.1 but we keep supporting the realtimeURL key when the realtime key is undefined.
Option 2: deduce from the backend id
Assuming each backend has exactly a single realtime connector, the connector is not resolved by a hint, but by the id of the current backend.
When a backend does not define a specific realtime connector, the default HocuspocusProvider is used.
Note that choosing option 2 does not prevent to add option 1.x later.
Meaning that in the absence of a realtime hint, but in the presence of a realtime url, the connector would be resolved by backend id.
WDYT?
I’m +1 for option 2 for now as its is enough for our current needs.