Real-time Updates
Connect to HookWatch via WebSocket to receive webhook events in real-time. Perfect for live dashboards, instant notifications, and debugging.
Connecting
Connect to the WebSocket endpoint with your access token as a query parameter.
WebSocket URL
wss://ws.hookwatch.dev/v1/ws?token=YOUR_ACCESS_TOKENExample
Message Types
Subscribe
Subscribe to receive events from specific endpoints.
Unsubscribe
Stop receiving events from specific endpoints.
Event
Received when a new webhook arrives at a subscribed endpoint.
Status Update
Received when a webhook event's delivery status changes.
Connection Lifecycle
Connect
Establish a WebSocket connection with your access token. The server validates your token and establishes the connection.
Subscribe
Send a subscribe message with the endpoint IDs you want to monitor. You can subscribe to multiple endpoints in a single message.
Receive Events
The server pushes events and status updates as they occur. Process these messages to update your UI or trigger actions.
Keep Alive
The server sends periodic ping messages. Your client should respond with pong to keep the connection alive. Most WebSocket libraries handle this automatically.
Best Practices
Reconnection
Implement automatic reconnection with exponential backoff. Network issues are common, and your app should handle disconnections gracefully.
Token Refresh
Access tokens expire after 15 minutes. Refresh your token before it expires and reconnect with the new token to avoid interruptions.
Rate Limiting
Don't open multiple connections for the same user. Use a single connection and subscribe to multiple endpoints as needed.
Error Handling
| Close Code | Reason | Action |
|---|---|---|
1000 | Normal closure | Connection closed cleanly, reconnect if needed |
4001 | Unauthorized | Invalid or expired token, refresh and reconnect |
4002 | Invalid message | Check message format and retry |
4029 | Rate limited | Too many connections, wait and retry |