unstale

npm / @hocuspocus/provider

@hocuspocus/provider

What changed in @hocuspocus/provider 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.

6 breaking1 security10 new APIs and options1 performance4 behavior and defaults20 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@hocuspocus/provider 430 changes

Breaking changes 4

  • When beforeHandleMessage throws, other messages that were already queued are no longer processed.

    4.5.0release notes

  • The CloseEvent passed to onClose callbacks now contains only code and reason; target and type are no longer available.

    4.0.0release notes

  • attach() now throws an error when attaching two authenticated providers with the same effective name instead of silently overwriting the existing provider.

    4.0.0release notes

  • The provider no longer imports or re-exports Event, MessageEvent, or CloseEvent from ws; TypeScript users relying on those types should import from @hocuspocus/common or use web-standard types.

    4.0.0release notes

Security 1

  • Enforces resource limits before authentication to safeguard server stability.

    4.3.0release notes

New APIs and options 8

  • Adds an option for batching updates to reduce websocket traffic during heavy editing.

    4.4.0release notes

  • Adds consistent state synchronization across Redis instances.

    4.4.0release notes

  • Adds a hook that runs after message handling completes.

    4.3.0release notes

  • Adds the unloadImmediately option to configure document persistence behavior when disconnect() is called.

    4.2.0release notes

  • Exposes sessionAwareness in provider-react HocuspocusRoom.

    4.1.1release notes

  • Adds the beforeHandleAwareness hook for handling awareness updates.

    4.1.0release notes

  • Adds application-level Ping (9) and Pong (10) message types; the provider responds to server Ping messages with Pong, replacing WebSocket-level ping/pong.

    4.0.0release notes

  • Adds an opt-in that embeds a unique sessionId in message document names, allowing multiple providers with the same document name on one WebSocket; it defaults to false for v3 compatibility.

    4.0.0release notes

Performance 1

  • extension-redis now delays forwarding messages to Redis with setImmediate, improving performance when many users are connected to the same document.

    4.6.0release notes

Behavior and default changes 3

  • Updates are batched before being sent to clients.

    4.5.0release notes

  • The provider sends its package version in the authentication message; v3 servers safely ignore the extra field.

    4.0.0release notes

  • Unknown message types now log console.error instead of throwing, allowing future protocol additions without crashing the provider.

    4.0.0release notes

Fixes and other changes 13

  • Batched changes are sent when the page is hidden.

    4.7.1release notes

  • A pending reconnect is canceled when disconnect() or destroy() is called.

    4.7.1release notes

  • The retry cancel handle is kept until the connection attempt resolves.

    4.7.1release notes

  • Emits maxAttemptsFailed instead of an unhandled rejection when attempts fail.

    4.7.0release notes

  • Redis sync replies are published only to the requester.

    4.7.0release notes

  • Messages are ignored in awarenessUpdateHandler when origin is this.

    4.5.0release notes

  • Allows binding the server to a specific address.

    4.4.0release notes

  • Ensures server.destroy() only runs once.

    4.4.0release notes

  • Deletes the debouncer timer entry before awaiting the in-flight execution.

    4.1.2release notes

  • Fixes client-initiated broadcastStateless.

    4.1.1release notes

  • Scratch Awareness objects in MessageReceiver are destroyed to fix a memory leak.

    4.1.1release notes

  • Wraps awareness origin as TransactionOrigin.

    4.1.0release notes

  • When the WebSocket is not yet open and messages are queued, duplicate awareness messages for the same document are deduplicated, keeping only the latest one.

    4.0.0release notes

@hocuspocus/provider 312 changes

Breaking changes 2

  • Tightens the types for authorizedScope.

    3.4.4release notes

  • beforeSync is no longer awaited, to avoid breaking message order.

    3.4.0release notes

New APIs and options 2

  • A document now exposes lastChangeTime, which can be used to identify when it last had changes.

    3.4.0release notes

  • Adds a hook for re-syncing auth tokens.

    3.3.0release notes

Behavior and default changes 1

  • Redis unloading logic was rewritten to utilize before/after-unload hooks.

    3.2.6release notes

Fixes and other changes 7

  • Fixes websocket URLs ending with / so they work.

    3.4.4release notes

  • Fixes a memory leak under high load.

    3.4.2release notes

  • Prevents a crash related to awareness in extension-redis.

    3.4.1release notes

  • Fixes a memory leak in onStoreDocument in extension-redis.

    3.4.1release notes

  • Debounce now prevents a storeDocumentHook from running concurrently, even when a new debounced function starts before the previous one finishes.

    3.4.0release notes

  • Fixes timing issues when multiple users leave the same document together.

    3.3.0release notes

  • The onUpdate listener is bound before afterLoadDocument is called, so document changes can trigger storeDocumentHooks.

    3.2.6release notes