Configure Hocuspocus Server

Introduction

There are only a few settings to pass for now. Most things are controlled through hooks.

Settings

SettingDescriptionDefault value
nameA name for the instance, used for logging.
portThe port the server should listen on.80
timeoutA connection healthcheck interval in milliseconds.30000 (= 30s)
debounceDebounces the call of the onStoreDocument hook for the given amount of time in ms. Otherwise every single update would be persisted.2000 (= 2s)
maxDebounceMakes sure to call onStoreDocument at least in the given amount of time (ms).10000 (= 10s)
quietBy default, the servers show a start screen. If passed false, the server will start quietly.false

Usage

import { Server } from "@hocuspocus/server";

const server = new Server({
  name: "hocuspocus-fra1-01",
  port: 1234,
  timeout: 30000,
  debounce: 5000,
  maxDebounce: 30000,
  quiet: true,
});

server.listen();