tiptap-collab-server
v1.3.1
Published
A socket.io server for tiptap collaboration module. Handles multi-documents, users cursors, and hooks for programmers.
Downloads
6
Maintainers
Readme
tiptap-collab-server
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
Installation
npm install tiptap-collab-server
Basic Setup
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();
Tests
npm run test
Tests need node v12.x or higher.
Contributions are welcome.
Contributing
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.