A socket.io server for tiptap collaboration module. Handles multi-documents, users's cursors, and hooks for programmers.
A full tutorial for setting this up is available in this article on Naept's blog or on Medium
npm install tiptap-collab-server
import CollabServer from 'tiptap-collab-server'
new CollabServer({
port: 6002,
namespaceFilter: /^\/[a-zA-Z0-9_/-]+$/,
lockDelay: 1000,
lockRetries: 10,
})
.connectionGuard(({
namespaceName,
roomName,
clientID,
requestHeaders,
options,
}, resolve) => {
resolve();
})
.onClientConnect(({
namespaceName,
roomName,
clientID,
requestHeaders,
clientsCount,
}, resolve) => {
resolve();
})
.initDocument(({
namespaceName,
roomName,
clientID,
requestHeaders,
clientsCount,
version,
doc,
}, resolve) => {
resolve({ version, doc });
})
.leaveDocument(({
namespaceName,
roomName,
clientID,
requestHeaders,
clientsCount,
version,
doc,
deleteDatabase,
}, resolve) => {
resolve();
})
.onClientDisconnect(({
namespaceName,
roomName,
clientID,
requestHeaders,
clientsCount,
}, resolve) => {
resolve();
})
.serve();
npm run test
Tests need node v12.x or higher.
Contributions are welcome.
Builds library for publication
npm run test
Compiles and starts example app for development
npm run serve-example
Issues and pull-requests are welcome and will be considered.