<!-- https://testapilocally.com/docs/core-features/protocols/ -->
# Protocols

SignOff Studio speaks **REST**, **GraphQL**, **WebSocket**, **SSE**, **gRPC**, and **MQTT** from the shared API request builder on Windows App v26.8.45 and VS Code Extension v0.2.114.

---

### REST

* **Platform Availability:** Full Parity
* **Overview:** Classic HTTP methods with params, auth, headers, bodies (None / JSON / Form / Multipart / Binary / Raw), scripts, and asserts. This is the default protocol for most collections, including the Starter Guide.
* **How It Works (Windows App):**
  1. Open **API** mode and select or create a request.
  2. Set method (GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS) and URL (`{{baseUrl}}/...`).
  3. Configure Params / Auth / Headers / Body, then **Send** (**Ctrl+Enter**).

![Windows REST request](/docs/assets/screenshots/windows/windows-request-builder.png)

* **How It Works (VS Code Extension):**
  1. Open SignOff Studio in the editor webview.
  2. Build the request the same way as Windows.
  3. Inspect Pretty / Raw / Headers / Explorer / Checks in the response panel.

![VS Code REST request](/docs/assets/screenshots/vscode/vscode-request-builder.png)

* **Code / Configuration Examples:**

```http
POST {{baseUrl}}/post
Content-Type: application/json

{
  "name": "Ada",
  "role": "engineer"
}
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - Follow redirects and SSL verification are Settings → General defaults; override per request in **Settings**.
  - Multipart file parts need real file paths readable by the host process.

---

### GraphQL

* **Platform Availability:** Full Parity
* **Overview:** GraphQL queries and mutations use the GraphQL body mode; schema introspection powers editor assist. Subscriptions can use `graphql-ws` over WebSocket transport.
* **How It Works (Windows App):**
  1. Set body type to **GraphQL** (or open a GraphQL-protocol request).
  2. Enter query/mutation and variables JSON.
  3. Introspect when the server allows it; use Stream/Pretty for results.

![Windows GraphQL](/docs/assets/screenshots/windows/windows-protocols-graphql.png)

* **How It Works (VS Code Extension):**
  1. Same GraphQL body editor in the shared shell.
  2. Introspection and subscriptions use the extension-host protocol transports.
  3. Keep auth headers / bearer tokens on the request for private graphs.

![VS Code GraphQL](/docs/assets/screenshots/vscode/vscode-protocols-graphql.png)

* **Code / Configuration Examples:**

```graphql
query Pet($id: ID!) {
  pet(id: $id) {
    id
    name
    status
  }
}
```

```json
{ "id": "1" }
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - Subscriptions need a WS-capable endpoint; HTTP-only GraphQL servers will fail subscribe.
  - Large introspections can be slow — cache schema locally when iterating.

---

### WebSocket

* **Platform Availability:** Full Parity
* **Overview:** Persistent duplex connections for message-oriented APIs. Connect, send frames, and watch the Stream tab for inbound traffic.
* **How It Works (Windows App):**
  1. Create a WebSocket request with `ws://` or `wss://` URL.
  2. Connect, then send text/JSON payloads from the composer.
  3. Disconnect explicitly when finished; review Stream history.

![Windows WebSocket](/docs/assets/screenshots/windows/windows-protocols-websocket.png)

* **How It Works (VS Code Extension):**
  1. Identical WebSocket UI in the webview.
  2. Transport runs in the extension host (survives webview focus changes better than pure browser WS).
  3. Use **Restore Response Panel** if the stream view was closed.

![VS Code WebSocket](/docs/assets/screenshots/vscode/vscode-protocols-websocket.png)

* **Code / Configuration Examples:**

```text
wss://echo.websocket.events
```

```json
{ "type": "ping", "ts": 1710000000 }
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - Corporate proxies often break `wss://` — configure Proxy in desktop Settings or test off-VPN.
  - Subprotocol / custom headers depend on server requirements; set them before connect.

---

### Server-Sent Events (SSE)

* **Platform Availability:** Full Parity
* **Overview:** One-way event streams over HTTP. Signoff opens the stream and appends events in the Stream / response views until you stop.
* **How It Works (Windows App):**
  1. Create an SSE request pointing at an `text/event-stream` endpoint.
  2. Send/Connect and watch events arrive.
  3. Stop the stream from the response toolbar when done.

![Windows SSE](/docs/assets/screenshots/windows/windows-live-main.png)

* **How It Works (VS Code Extension):**
  1. Same SSE request type in the shared shell.
  2. Leave the panel open while streaming.
  3. Asserts on SSE are limited — prefer Runner checks on discrete HTTP sibling requests.

![VS Code SSE](/docs/assets/screenshots/vscode/vscode-live-main.png)

* **Code / Configuration Examples:**

```http
GET {{baseUrl}}/sse
Accept: text/event-stream
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - Buffers / proxies may delay events; test against a known local SSE mock when debugging.
  - Authed SSE often needs cookies or Authorization on the initial GET.

---

### gRPC

* **Platform Availability:** Full Parity
* **Overview:** Unary and streaming gRPC calls with service list / server reflection when the target supports it. Proto-aware editing lives in the gRPC request surface.
* **How It Works (Windows App):**
  1. Create a gRPC request; set host (and TLS options).
  2. **List** / **Reflect** services when available, pick method, fill message JSON.
  3. Invoke and inspect trailers/status in the response pane.

![Windows gRPC](/docs/assets/screenshots/windows/windows-protocols-grpc.png)

* **How It Works (VS Code Extension):**
  1. Same gRPC flow via host protocol transports.
  2. Reflection must be enabled on the server for browse-without-proto workflows.
  3. CLI `npm run runner` can also execute gRPC requests in collections.

![VS Code gRPC](/docs/assets/screenshots/vscode/vscode-protocols-grpc.png)

* **Code / Configuration Examples:**

```text
Host: localhost:50051
Service: pets.Pets/GetPet
```

```json
{ "id": 1 }
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - Plaintext vs TLS mismatch is the #1 connect failure — match server config.
  - Without reflection, ship `.proto` / descriptor inputs with the collection docs.

---

### MQTT

* **Platform Availability:** Full Parity
* **Overview:** Publish/subscribe messaging for IoT and event buses. Connect to a broker, subscribe to topics, and publish payloads from the request UI.
* **How It Works (Windows App):**
  1. Create an MQTT request; set broker URL, client id, and credentials.
  2. Subscribe to topics; publish test messages.
  3. Watch inbound messages in the stream/output panel.

![Windows MQTT](/docs/assets/screenshots/windows/windows-protocols-mqtt.png)

* **How It Works (VS Code Extension):**
  1. Same MQTT UI; broker connections originate from the extension host.
  2. Ensure firewall allows outbound MQTT/MQTTS ports.
  3. Use env vars for broker passwords — never commit secrets.

![VS Code MQTT](/docs/assets/screenshots/vscode/vscode-protocols-mqtt.png)

* **Code / Configuration Examples:**

```text
mqtts://broker.example.com:8883
topic: pets/+/status
payload: {"status":"available"}
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - QoS and retained messages are broker-specific — verify with a known topic first.
  - WebSocket MQTT URLs differ from raw TCP MQTT; pick the correct transport.

---

## Auth across protocols

Supported auth types (request / folder / collection inherit): **none**, **inherit**, **bearer**, **basic**, **api-key**, **oauth2**, **oauth1**, **digest**, **aws-signature**, **hawk**, **custom**. **ntlm** appears in the UI but is **not supported yet**.

See [Authentication](/docs/authentication/).

---

## Related

- [Requests](/docs/requests/)
- [Load testing](/docs/core-features/load-testing/)
- [MCP & CLI](/docs/core-features/mcp-and-cli/)
