Skip to content

A socket.io server for tiptap collaboration module. Handles multi-documents, users's cursors, and hooks for programmers.

License

Notifications You must be signed in to change notification settings

naept/tiptap-collab-server

Repository files navigation

tiptap-collab-server

A socket.io server for tiptap collaboration module. Handles multi-documents, users's cursors, and hooks for programmers.

NPM Version Build Status Codacy Badge Coverage Status Dev dependencies

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.

About

A socket.io server for tiptap collaboration module. Handles multi-documents, users's cursors, and hooks for programmers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published