WebSocketDevtools
A panel in a corner of the page that shows what each WebSocket client is doing: its status and reconnect attempts, what's queued and buffered, how many messages it received, and the round-trip time, topics, feeds, outbox, presence and runs of the helpers that use it.
Available only from react-websocket/devtools, about 1.8 kB min+gzip, separate from the main entry's size.
Usage
Render it in development only, so it stays out of your production bundle:
A button in the corner shows how many clients there are, with a dot for the worst status among them. Click it to see each client:
Props
Behavior
- Refresh. It re-renders twice a second, and counts messages from the moment it mounts.
- Server rendering. It renders nothing on the server and during hydration.
- In production builds, the clients
useWebSocket(url)shares aren't listed by themselves; pass theirclientinsources.