Skip to content

Releases: volkov85/react-realtime-hooks

v1.2.1

10 Apr 11:48
4d11bcf

Choose a tag to compare

Patch Changes

  • ffc144a: Ignore stale WebSocket events from replaced connections to prevent old sockets from corrupting the current hook state during reconnects or transport reconfiguration.

v1.2.0

06 Apr 14:14
e32fa22

Choose a tag to compare

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

29 Mar 16:05
7d70953

Choose a tag to compare

Minor Changes

  • bac739a: Add usePageVisibility hook with transition timestamps and public exports

v1.0.4

24 Mar 15:57
d8a095f

Choose a tag to compare

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

19 Mar 13:27
ffdf210

Choose a tag to compare

Patch Changes

  • b221139: Improve heartbeat failure handling in useHeartbeat/useWebSocket by surfacing beat errors and adding timeout-driven close/reconnect behavior.

v1.0.2

18 Mar 11:59
5439bfc

Choose a tag to compare

Patch Changes

  • aa534ba: Treat parseMessage failures as terminal transport errors by closing the current WebSocket or EventSource connection, stopping auto-reconnect, and requiring an explicit open() or reconnect() to recover.

v1.0.1

17 Mar 13:11

Choose a tag to compare

Patch Changes

  • 7110259: Refresh README and move maintainer docs to CONTRIBUTING.md

v1.0.0

17 Mar 09:19
710bf85

Choose a tag to compare

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

  • useOnlineStatus
  • useReconnect
  • useHeartbeat
  • useWebSocket
  • useEventSource

Highlights

  • Typed React hooks for WebSocket, SSE, reconnect, heartbeat, and browser online state
  • Generic payload support for incoming and outgoing transport messages
  • Custom parseMessage / serializeMessage hooks 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

  • useWebSocket and useEventSource are exposed in the demo as playground blocks with manual URL input
  • useEventSource is receive-only by design
  • transport hooks require real endpoints when tested in the hosted demo

Tooling

  • TypeScript
  • Vitest
  • ESLint
  • tsup
  • publint
  • GitHub Actions
  • Changesets