Releases: volkov85/react-realtime-hooks
Releases · volkov85/react-realtime-hooks
v1.2.1
v1.2.0
Minor Changes
- 25d9e30: Add useConnectionGate, a new core hook that combines browser online state and page visibility into a single connect flag for useWebSocket and useEventSource. It supports hidden-tab grace periods, exposes a deterministic gate reason, and includes transition timestamps for ready/blocked state changes. README and demo were updated to cover the new hook.
v1.1.0
v1.0.4
Patch Changes
- 19add81: Narrow the React peer dependency to React 19, align the README with the supported version, and tighten realtime error handling. This update makes onError fire consistently for transport, heartbeat, and parse failures, updates lastChangedAt on native WebSocket errors, and clears heartbeat timing state on stop so reconnects start with fresh metrics.
v1.0.3
v1.0.2
v1.0.1
v1.0.0
react-realtime-hooks v1.0.0
First public release of react-realtime-hooks: a TypeScript-first React hooks library for realtime transport state and connection lifecycle.
Included hooks
useOnlineStatususeReconnectuseHeartbeatuseWebSocketuseEventSource
Highlights
- Typed React hooks for WebSocket, SSE, reconnect, heartbeat, and browser online state
- Generic payload support for incoming and outgoing transport messages
- Custom
parseMessage/serializeMessagehooks integration - Discriminated connection state unions for safer TypeScript narrowing
- SSR-safe behavior for browser-only APIs
- Reconnect flow with exponential backoff and jitter support
- Heartbeat flow with timeout and ack tracking
- Behavior tests for reconnect, cleanup, parse errors, manual reconnect/close, and transport mocks
- Public demo deployed on GitHub Pages
Demo
https://volkov85.github.io/react-realtime-hooks/
Package goals
This release focuses on providing a clean base for realtime React applications:
- transport hooks with explicit state
- reusable reconnect and heartbeat primitives
- strong TypeScript ergonomics
- library-quality tooling, tests, CI, and release setup
Notes
useWebSocketanduseEventSourceare exposed in the demo as playground blocks with manual URL inputuseEventSourceis receive-only by design- transport hooks require real endpoints when tested in the hosted demo
Tooling
- TypeScript
- Vitest
- ESLint
- tsup
- publint
- GitHub Actions
- Changesets