Skip to content

v2.0.0 - Multiplexing

Compare
Choose a tag to compare
@janthurau janthurau released this 29 Mar 14:40
· 256 commits to main since this release
v2.0.0
2580d56

Hocuspocus 2.0.0 Release

After the stable release in January 2023, Hocuspocus gets its first major version update with the new core feature called “Multiplexing”.
Multiplexing allows you to synchronize multiple documents over the same websocket connection. This is especially useful when working with multiple documents at the same time and will make this experience even faster.

Please note that you need to update both the provider and the server, versions cannot be mixed


The client/server protocol has been changed, so if you are handling messages directly, you might have to adjust something. Otherwise, if you don't want to use multiplexing, you don't need to change anything.

Before:
[HocuspocusMessageType][YjsMessageType][yjs binary]

After:
[documentName][HocuspocusMessageType][YjsMessageType][yjs binary]

Using multiplexing

See this example on how to use multiplexing (more docs will follow):

const socket = new HocuspocusProviderWebsocket({
  url: 'ws://127.0.0.1:1234',
})

const provider = new HocuspocusProvider({
  websocketProvider: socket,
  name: 'hocuspocus-demo',
  broadcast: false,
})

const anotherProvider = new HocuspocusProvider({
  websocketProvider: socket,
  name: 'hocuspocus-demo2',
  broadcast: false,
})

TiptapCollab

TiptapCollab runs Hocuspocus 2, so it fully supports multiplexing