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
1
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.2
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.3
Receive connected confirmation
The gateway picks an agent, the agent connects to the target WebSocket, and the gateway responds with:
4
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.
SSE events
connected — Agent connected to broker, queue created and bound:
message — Message received from queue:
error — Connection or consumption error (stream ends):