snapshot of https://github.com/ueberdosis/hocuspocus.git @ cf3cfa355b4d3bb61c6b6c80071f71783e32470e (2026-09-15)
Some checks failed
build / lint (22) (push) Failing after 17s
build / test (22) (push) Failing after 8s
build / lint (23) (push) Failing after 2s
build / build (22) (push) Has been skipped
build / build (23) (push) Has been skipped
build / test (23) (push) Failing after 4s
docsearch / docsearch (push) Failing after 1s
Some checks failed
build / lint (22) (push) Failing after 17s
build / test (22) (push) Failing after 8s
build / lint (23) (push) Failing after 2s
build / build (22) (push) Has been skipped
build / build (23) (push) Has been skipped
build / test (23) (push) Failing after 4s
docsearch / docsearch (push) Failing after 1s
This commit is contained in:
48
packages/extension-throttle/README.md
Normal file
48
packages/extension-throttle/README.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# @hocuspocus/extension-throttle
|
||||
[](https://www.npmjs.com/package/@hocuspocus/extension-throttle)
|
||||
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
||||
[](https://www.npmjs.com/package/@hocuspocus/extension-throttle)
|
||||
[](https://github.com/sponsors/ueberdosis)
|
||||
|
||||
Rate-limit and throttle connections to a [Hocuspocus](https://github.com/ueberdosis/hocuspocus) server by IP. Protects your collaboration backend from abuse, accidental reconnect loops, and misbehaving clients.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @hocuspocus/extension-throttle
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
With default thresholds (15 connection attempts per 60 seconds, 5 minute ban):
|
||||
|
||||
```js
|
||||
import { Server } from "@hocuspocus/server"
|
||||
import { Throttle } from "@hocuspocus/extension-throttle"
|
||||
|
||||
const server = new Server({
|
||||
extensions: [new Throttle()],
|
||||
})
|
||||
|
||||
server.listen()
|
||||
```
|
||||
|
||||
### Tune the limits
|
||||
|
||||
```js
|
||||
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](https://tiptap.dev/docs/hocuspocus/server/extensions/throttle).
|
||||
|
||||
## License
|
||||
|
||||
MIT — see [LICENSE.md](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
|
||||
Reference in New Issue
Block a user