@hocuspocus/extension-throttle
v4.0.0
Published
hocuspocus throttle extension
Readme
@hocuspocus/extension-throttle
Rate-limit and throttle connections to a Hocuspocus server by IP. Protects your collaboration backend from abuse, accidental reconnect loops, and misbehaving clients.
Installation
npm install @hocuspocus/extension-throttleUsage
With default thresholds (15 connection attempts per 60 seconds, 5 minute ban):
import { Server } from "@hocuspocus/server"
import { Throttle } from "@hocuspocus/extension-throttle"
const server = new Server({
extensions: [new Throttle()],
})
server.listen()Tune the limits
new Throttle({
throttle: 30, // allowed connection attempts per window
consideredSeconds: 60, // window length in seconds
banTime: 5, // ban duration in minutes
})Pass throttle: false (or null) to effectively disable the limiter without removing the extension.
Documentation
Full options reference: tiptap.dev/docs/hocuspocus/server/extensions/throttle.
License
MIT — see LICENSE.md.
