# robtaussig/react-use-websocket

React Hook for WebSocket communication

Repository: https://github.com/robtaussig/react-use-websocket
Canonical: https://ross.abutalabs.com/products/react-use-websocket
Language: TypeScript
License: MIT
License Family: permissive
Last push: 2025-02-04T05:15:22+00:00

## Health v2 (maintenance only)
Score: 25/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 5, release rhythm 8, longevity 100
- inputs: {"age_days": 2678, "days_push": 575, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1886, forks 155 (observed 2026-08-28T04:05:49.016588+00:00)

## What it is
A React Hook library that provides robust WebSocket integration for React components, with features like automatic reconnection, JSON message handling, and ready-state tracking. It also offers experimental SocketIO support.

## Use cases
- connect to a websocket from a react component
- handle real-time messages in react
- auto-reconnect websocket in react app
- send and receive json over websocket in react
- track websocket connection status in ui
- use socketio with react hooks

## When to choose
- you need declarative WebSocket usage inside React function components
- you want built-in reconnection, heartbeats, and JSON message helpers
- you want a small, focused hook rather than a full state-management solution

## When to avoid
- you are not using React
- you need full Socket.IO protocol support (only experimental)
- you need server-side WebSocket handling rather than a client hook

## Facets
- artifact type: library
- maturity: active
- function: websocket, http-client, state-management
- domain: web-development, frontend
- platform: browser
- tags: react-hooks, websocket-client, real-time-communication, socketio, real-time, nodejs, web-server

## Member repositories
- robtaussig/react-use-websocket (main) score 25

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:49.016588+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:13:35.517715+00:00, confidence not recorded.
  - readme: https://github.com/robtaussig/react-use-websocket (fetched 2026-08-28T04:05:49.016588+00:00, sha f1660bfea113)
  - registry_npm: https://registry.npmjs.org/react-use-websocket (fetched 2026-08-29T10:52:49.069272+00:00, sha d45a4d71e8fc)
- Data as of 2026-08-30T08:39:29.467469+00:00.
