Skip to content

WebSocket, GraphQL and gRPC

Besides HTTP requests, an API doc’s requests can be WebSocket or gRPC requests, and an HTTP request can carry a GraphQL query. The desktop app connects and sends; on the web you can read and edit them, and copy them to run elsewhere.

+ → New WebSocket request adds one. It has a URL (ws:// or wss://), Params, Headers and Auth, as an HTTP request does.

  • Message: write a message as Text, JSON or Binary (base64). Save message keeps it with the request, so your team has it too. Saved messages are listed under it; Use puts one back in the box.
  • Connect opens the connection from your computer. Send (or ⌘Enter) sends the message. Every message in and out shows in the log with its time to the millisecond and its size; click one to see all of it.
  • Disconnect closes it. Reconnect automatically connects again if the server drops the connection. It’s off unless you turn it on, and it’s set for this computer only.

Keys in your variables are filled in on your computer and never shown in the log: if a server echoes one back, you see {{token}}.

Pick GraphQL as a request’s body. Write the query, and the variables as JSON.

In the desktop app, Fetch schema asks the server for its schema (introspection), using the request’s own URL, headers and auth, so it works whether or not the doc’s spec is GraphQL. Then:

  • the query box completes fields and arguments, marks mistakes as you type, and shows a type’s docs when you point at it;
  • Docs opens the schema: the query, mutation and subscription fields, each type’s fields and arguments, and a search by type name.

The schema is kept on your computer for that URL, not in the doc. Refresh schema fetches it again.

+ → New gRPC request adds one: the server (localhost:50051), the method (bookings.v1.Bookings/GetBooking), TLS on or off, Metadata (sent as gRPC metadata, with the request’s Auth), the Message as JSON, and a .proto you paste in, kept in the doc. A server written grpcs://… uses TLS and grpc://… doesn’t, whatever the switch says.

In the desktop app:

  • Methods lists the server’s methods with their kind and message types. With a .proto, they come from it; without one, the app asks the server (gRPC reflection). Pick one to set the method; an empty message gets an example with every field, and Use example puts the example back.
  • Invoke calls the method. A unary or server streaming call sends the message and shows every reply as it comes.
  • A client or bidirectional streaming call stays open: Send (or ⌘Enter) sends the message box as it is now, as often as you like, and End streaming tells the server you’re done.
  • Cancel ends a call that’s still running.

The log shows every message in and out as JSON, with its time and size, then the call’s status (OK, or a code such as NOT_FOUND with the server’s message) and how long it took. The server’s headers and trailers are under Metadata from the server. As with WebSocket, keys from your variables never show in the log, even when a server echoes one back.

Agents see these requests in the doc’s outline at the same small cost as any request: r7 WS wss://ws.bookings.example/board · Studio board. Reading a request in full lists its saved messages, and an agent can add or change them. Asking for a WebSocket request as a call gives a websocat command, and a gRPC request a grpcurl command. A gRPC request’s .proto reads as one line (its package, services and how many methods), not the whole file.

Postman’s v2.1 collection files don’t carry WebSocket or gRPC requests (Postman leaves them out of its own exports too). So an import from Postman has none, and an export to Postman leaves them out.