WebSocket relay
The Scraping API can relay bidirectional WebSocket connections through the agent network. All WS sub-protocols are relayed transparently — Socket.IO, SignalR, Centrifugo, GraphQL-WS, raw WebSocket, etc.Endpoint
Connection flow
Connect to the gateway
Open a WebSocket connection to
wss://scraping-api.55-tech.com/ws. No authentication happens at connection time — the gateway accepts immediately.Send connect message (within 10 seconds)
Send a JSON message specifying the target URL and your API key. You have 10 seconds to send this message before the connection is closed with code
1008.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | — | Your API key (also accepts key) |
url | string | Yes | — | Target WebSocket URL (wss://... or ws://...) |
headers | object | No | {} | Custom headers for the WS upgrade request |
cookies | object | No | {} | Cookies to send with the WS upgrade request |
geo | string | No | — | Country filter for agent selection (e.g., US,DE) |
agent | string | No | — | Pin to specific agent(s) by slug (e.g., de1 or de1,at5) |
idle_timeout | float | No | 0 | Seconds to wait for a target message before disconnect. 0 = no timeout |
Receive connected confirmation
The gateway picks an agent, the agent connects to the target WebSocket, and the gateway responds with:
| Field | Description |
|---|---|
type | Always "connected" |
status | HTTP status of the WS upgrade (101) |
node_id | Proxy node handling the connection |
Relay frames bidirectionally
After connection, all text and binary frames are relayed transparently:
- Client → target: Your messages are forwarded to the target as-is
- Target → client: Target messages are forwarded to you as-is
- Close frame: Triggers graceful shutdown on both sides
- PONG frames: From target are forwarded to client
Error responses
If something goes wrong, the gateway sends:- Invalid or missing API key (close code
1008) - Rate limit exceeded (close code
1008) - Connect message not received within 10 seconds (close code
1008) - Target connection failed
- Agent unavailable
Example: Python
Example: JavaScript
Supported sub-protocols
All sub-protocols are relayed transparently — no special configuration needed:- Raw WebSocket (text/binary)
- Socket.IO (engine.io transport)
- SignalR (JSON +
\x1edelimiter) - Centrifugo (JSON-RPC)
- GraphQL-WS subscriptions
AMQP consumer (SSE)
Stream messages from a RabbitMQ broker through the agent network, delivered as Server-Sent Events. The agent connects to the broker, creates a temporary auto-delete queue, binds it to the specified exchange, and streams messages back.Endpoint
Request body
X-API-Key header instead of the apiKey body field.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | — | Your API key (or use X-API-Key header) |
host | string | Yes | — | AMQP broker hostname |
port | int | No | 5672 | Broker port (use 5671 for SSL) |
virtual_host | string | No | / | AMQP virtual host |
username | string | No | "" | Broker username |
password | string | No | "" | Broker password |
exchange | string | No | "" | Exchange to bind to |
routing_key | string | No | # | Routing key pattern (# = all messages) |
queue_prefix | string | No | scrape | Prefix for the auto-delete queue name (e.g., scrape_de1_4821) |
ssl | bool | No | false | Use AMQPS (TLS) connection |
heartbeat | int | No | 60 | AMQP heartbeat interval in seconds |
geo | string | No | — | Country filter for agent selection |
agent | string | No | — | Pin to specific agent by slug |
SSE events
connected — Agent connected to broker, queue created and bound:
message — Message received from queue:
error — Connection or consumption error (stream ends):