The PolyApiIDE WebSocket client opens a ws or wss connection, logs every frame in both directions, and substitutes environment variables straight into the connection URL.
A WebSocket starts life as an ordinary HTTP request with Upgrade: websocket, the server answers 101 Switching Protocols, and from then on the channel stays open while frames travel both ways. That is awkward to inspect with curl: you need a client that holds the connection and shows the message history.
The usual questions are simple ones: does the server accept a connection on this address, is the token accepted, does the expected first frame arrive, and does the server react to the message you sent. All of that is only visible in a live channel — a frame log with timestamps and direction answers who stopped responding first far faster than application logs do.
In PolyApiIDE a WebSocket is a workspace type that sits in the same project as your REST and GraphQL requests. Hosts, tokens and channel names live in environments, so moving a connection between dev, test and production is a single switch.
The protocol type is set per workspace or per request. Use ws:// for local development and wss:// for everything else — a browser will not open an insecure socket from a secure page.
Move host, channel id and token into an environment: wss://{{host}}/ws?token={{token}}. The {{var}} and {var} substitution works in URLs exactly as it does for REST, so one request serves every stage.
A successful handshake means a 101 Switching Protocols response. If you get 401, 403 or 404 instead, the problem is still at the HTTP layer: address, auth, or proxy routing.
Messages go out as text — a JSON subscribe command, for example — and land in the same log as whatever the server pushes back. The log shows frame order, delays, and the moment the channel closed.
When the socket closes, the code tells you whether it was a clean shutdown, a drop, or a refusal. The common ones are in the table below.
| Code | Meaning | Where to look |
|---|---|---|
| 1000 | Normal closure agreed by both sides | Nothing broke |
| 1001 | One side is going away — tab closed or server restarting | Deploys, restarts, worker shutdown |
| 1006 | Abnormal closure with no close frame | Proxy, idle timeout, network drop |
| 1008 | Message violated server policy | Auth, frame format, limits |
| 1009 | Frame too large | Server message size limit |
| 1011 | Internal server error | Application logs, handler exception |
| 4000-4999 | Application-defined codes | Your service documentation |
Code 1006 usually means an intermediary cut the connection rather than your code: nine times out of ten it is an idle timeout on nginx or a load balancer.
The client lives inside the browser and uses the browser WebSocket API, which has its own rules. Custom headers cannot be set during the handshake — that is a platform restriction, not an extension one. Tokens therefore travel as a query parameter, a cookie or a subprotocol, not as an Authorization header. If your server accepts the header only, that check has to be done with a server-side tool.
Raw TCP sockets and binary protocols on top of them are out of reach as well: a browser speaks HTTP and WebSocket, nothing lower. Load profiles in the extension target HTTP requests, not thousands of concurrently held sockets.
No. Free works as soon as the extension is installed; no account is needed to send requests or open a WebSocket connection.
No — the browser WebSocket API does not allow handshake headers. Working options are a query parameter, a cookie or a subprotocol. This is a platform limit and applies to every browser-based client.
Usually an idle timeout on a reverse proxy. Check the nginx or balancer settings and send ping frames from the application. In the log it shows up as code 1006 with no close frame.
For local development yes; for anything else the browser will insist on wss:// and refuse to mix a secure page with an insecure socket.
The requests and addresses are — they live in collections stored locally in the browser. An open socket, naturally, only lasts while the extension is running.