tiptap-collab-server

1.3.1 • Public • Published

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.

Package Sidebar

Install

npm i tiptap-collab-server

Weekly Downloads

1

Version

1.3.1

License

MIT

Unpacked Size

42.6 kB

Total Files

9

Last publish

Collaborators

  • julien1138