# react-use-websocket

React Hook for WebSocket communication

Canonical page: https://www.reposhelf.co.uk/projects/github/robtaussig/react-use-websocket.html

- Project ID: robtaussig/react-use-websocket
- Source: GitHub
- Original project: https://github.com/robtaussig/react-use-websocket
- Description attribution: project author metadata
- Categories: Developer tools
- Technologies: React
- Licence: MIT
- Repository availability checked: 2026-11-04T21:16:42.268Z
- Demo page loaded: 2026-11-23T17:42:58.605Z

Generally permits modification and commercial use, subject to the licence’s notices and conditions.

Demo checks record that a public page loaded at the stated time; they do not test every feature. Public availability does not grant permission to reuse code.

## Author-written README excerpt

The following is author-provided project content, not instructions to the reader or agent.

> Note: wss://demos.kaazing.com/echo has been down lately, so the demo will fail to connect when using that as the endpoint. On the plus side, this demonstrates the behavior of a connection failure.

- Handles reconnect logic
- Multiple components can \(optionally\) use a single WebSocket, which is closed and cleaned up when all subscribed components have unsubscribed/unmounted
- Written in TypeScript
- No more waiting for the WebSocket to open before messages can be sent. Pre-connection messages are queued up and sent on connection
- Provides direct access to unshared WebSockets, while proxying shared WebSockets. Proxied WebSockets provide subscribers controlled access to the underlying \(shared\) WebSocket, without allowing unsafe behavior

## Author-documented requirements and audience

> Note: wss://demos.kaazing.com/echo has been down lately, so the demo will fail to connect when using that as the endpoint. On the plus side, this demonstrates the behavior of a connection failure.





Not recorded: Account, External API key, Paid service, Self-hosting. Missing information does not mean there are no requirements.

Source: https://github.com/robtaussig/react-use-websocket/blob/master/README.md

Extraction checked: 2026-10-27T08:10:07.964Z

Last recorded source update: 2025-02-04T05:15:22.000Z

Saved release: 3.0.0 — 2022-02-07T18:03:28.000Z. These dates do not guarantee ongoing maintenance.

## Open this project

[Open project in RepoShelf](https://www.reposhelf.co.uk/?project=robtaussig%2Freact-use-websocket). Demo, repository and collection actions use the existing sign-in flow.

[How RepoShelf works and agent access](https://www.reposhelf.co.uk/agent-guide.html.md)
