npm / partysocket
partysocket
What changed in partysocket 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-15.
2 breaking1 deprecations5 new APIs and options3 behavior and defaults9 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpartysocket 120 changes
Breaking changes 2
close() dispatches its close event synchronously, and readyState reports CLOSED immediately after close() returns.
Narrows the exported type from ArrayBufferView to ArrayBufferView<ArrayBuffer> to match DOM WebSocket.send() overloads; runtime behavior is unchanged.
Deprecations 1
Calling send() after close() emits a warning once per close cycle; the message remains buffered for backwards compatibility, and the warning resets on reconnect().
New APIs and options 5
Adds an option that lets callers stop automatic reconnects for terminal close events while preserving reconnect-by-default behavior.
Adds a method that removes and returns messages buffered by send() but never transmitted, allowing a discarded socket's unsent buffer to be handed to a replacement.
Overrides buffered-message transfer behavior: true always transfers messages and false never transfers them.
Adds an enabled prop for conditional connection control.
Adds an enabled prop for conditional connection control.
Behavior and default changes 3
send() returns true when transmitted immediately and false when buffered or dropped because maxEnqueuedMessages was reached.
When replacing a socket because connection options changed, hooks migrate buffered messages by default only if the destination is unchanged; messages for changed destinations are discarded with a warning.
PartySocket is released as v1 after being described as pretty stable.
Fixes and other changes 9
Fixes the module-scope random default.
The protocols type now accepts ProtocolsProvider instead of string[], matching the full range of types supported by the underlying ReconnectingWebSocket.
Declared react as an optional peer dependency so strict package managers like pnpm correctly resolve it for the partysocket/react and partysocket/use-ws subpath exports.
On HMR or StrictMode effect re-runs, unchanged connection options now call socket.reconnect() to preserve socket identity; changed options still create a new socket.
Fixes reconnect() after maxRetries has been exhausted by releasing _connectLock when the max retries early return is hit.
Construction without room or basePath now throws a clear error unless startClosed: true, rather than connecting to a malformed URL.
PartySocket.reconnect() now accepts basePath without room as sufficient context to construct a connection URL.
Fixes a React Native/Expo TypeError by detecting those environments and using Node-style event cloning.
Fixes invalid package exports, so developers can use the package's exports correctly.