Comparison
| Feature | WebSocket | Webhook | Long-Polling |
|---|---|---|---|
| Latency | Real-time | Near real-time | Up to 30s |
| Direction | Bidirectional | Push to agent | Agent pulls |
| Persistent connection | Yes | No | No |
| Firewall-friendly | Requires WS support | Agent needs public URL | Yes |
| Best for | Interactive agents | Background automations | Simple scripts |
WebSocket
Real-time bidirectional communication via Socket.IO on the/ws namespace.
How it works
Events
| Event | Direction | Description |
|---|---|---|
message:created | Server → Client | New message in a subscribed channel |
review:responded | Server → Client | Human completed a review |
review:expired | Server → Client | Review expired (default: 24h) |
agent:status | Server → Client | Agent ping status changed |
Connection Example
WebSocket connections use JWT authentication (not API keys). This is primarily used by the
frontend. For agent integrations, prefer webhooks or long-polling with API keys.
Webhooks
Receive HTTP callbacks when a human responds. No persistent connection required, Placet pushes to your endpoint.How it works
Webhook Priority
Placet dispatches webhooks in a 3-tier priority order:- Message-level
webhookUrl: set per message in the request body - Agent-level
webhookUrl: configured on the agent in settings - Legacy callback: fallback for backward compatibility
Setting a Webhook
Per message:Webhook Security
- SSRF protection: Placet validates webhook URLs against an allowlist and blocks private/internal IPs
- Timeout: Webhook requests have a 10-second timeout
- Retries: Failed deliveries are not retried (design your agent to handle missed webhooks)
Long-Polling
The simplest pattern: your agent sends a request and waits for a response. No server infrastructure needed.How it works
Usage
Parameters
| Parameter | Default | Description |
|---|---|---|
channel | required | Agent/channel ID |
timeout | 30000 | Max wait time in ms (capped at 30000) |
Response States
status | Meaning |
|---|---|
completed | Human responded, response field contains the answer |
pending | Timeout reached, no response yet, retry the poll |
expired | Review expired (default 24h), no response will come |
Choosing a Pattern
I'm building an interactive chat agent
I'm building an interactive chat agent
Use Long-Polling with the
/api/v1/reviews/{id}/wait endpoint. It’s the simplest to implement and works from any environment. Send a message, poll for the response, then continue your logic.I'm running background automations (CI/CD, cron)
I'm running background automations (CI/CD, cron)
Use Webhooks. Set a
webhookUrl on each message and let Placet push responses to your server.
This way your automation doesn’t block while waiting.I'm building a web dashboard that shows live updates
I'm building a web dashboard that shows live updates
Use WebSocket. Connect via Socket.IO and subscribe to real-time events. This is how the Placet
frontend itself works.
I just want to send notifications without waiting
I just want to send notifications without waiting
Use fire-and-forget: simply
POST /api/v1/messages without a review field. No need for any response mechanism. Users still receive push notifications and see the message in real-time.