Streaming & Rate Limiting
HookSniff supports real-time delivery monitoring via SSE streaming, and per-endpoint rate limiting to protect your servers.
Real-Time Streaming (SSE)
Stream delivery events in real-time using Server-Sent Events (SSE). Useful for live dashboards, monitoring, and debugging.
Connect to Stream
curl -N https://hooksniff-api-1046140057667.europe-west1.run.app/v1/stream/deliveries \
-H "Authorization: Bearer hr_live_YOUR_KEY" \
-H "Accept: text/event-stream"Node.js SDK
import { HookSniff } from 'hooksniff';
const hs = new HookSniff({ apiKey: 'hr_live_xxx' });
// Stream delivery events
const stream = hs.stream.subscribe({
event_types: ['delivery.completed', 'delivery.failed'],
});
stream.on('event', (event) => {
console.log(`[${event.event}] ${event.data.message_id}: ${event.data.status}`);
});
stream.on('error', (err) => {
console.error('Stream error:', err);
// Auto-reconnects with backoff
});
// Close when done
// stream.close();Event Types
| Event | When |
|---|---|
| delivery.completed | Webhook delivered successfully (2xx) |
| delivery.failed | Delivery failed (non-2xx or timeout) |
| delivery.retrying | Delivery being retried |
| endpoint.disabled | Endpoint auto-disabled after repeated failures |
| endpoint.enabled | Endpoint re-enabled |
Rate Limiting
Protect your webhook endpoints from being overwhelmed. Configure per-endpoint rate limits using token bucket or sliding window algorithms.
Set Rate Limit
curl -X POST https://hooksniff-api-1046140057667.europe-west1.run.app/v1/endpoints/EP_ID/rate-limit \
-H "Authorization: Bearer hr_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"algorithm": "token_bucket",
"rate": 100,
"period": 60
}'
// → 100 requests per 60 secondsRate Limit Headers
Every API response includes rate limit headers:
| Header | Description |
|---|---|
| X-RateLimit-Limit | Maximum requests per window |
| X-RateLimit-Remaining | Requests remaining in current window |
| X-RateLimit-Reset | Unix timestamp when window resets |
| Retry-After | Seconds to wait (only on 429 responses) |
Handling 429
// All SDKs handle 429 automatically with exponential backoff.
// But you can also handle it manually:
try {
const endpoints = await hs.endpoint.list();
} catch (err) {
if (err.statusCode === 429) {
const retryAfter = parseInt(err.headers['retry-after']);
console.log(`Rate limited. Retry after ${retryAfter}s`);
await sleep(retryAfter * 1000);
// Retry
}
}API Rate Limits by Plan
| Plan | Requests/min | Webhooks/day |
|---|---|---|
| Developer (Free) | 100 | 100 |
| Startup ($24/mo) | 500 | 30,000 |
| Pro ($49/mo) | 1,000 | 100,000 |
| Enterprise | Custom | Unlimited |