---
title: "TCP Proxy WebSocket Connection"
method: GET
path: "/v1/tcp-proxy/{token}"
tags: ["TCP Proxy"]
---

# TCP Proxy WebSocket Connection

`GET /v1/tcp-proxy/{token}`

Establish a WebSocket connection for TCP proxy data transfer. This endpoint
requires a valid session token obtained from `POST /v1/tcp-proxy`.

**Token Properties:**
- Single-use: token is invalidated upon WebSocket connection
- Short-lived: expires after 30 seconds if not used
- No authentication header needed: token in path serves as authorization

**WebSocket Protocol:**
- Binary frames (opcode 0x02) are used for data transfer in both directions
- Text frames (opcode 0x01) are used for control messages (JSON format)
- Close frame (opcode 0x08) terminates the connection

**Control Messages (JSON):**
- Connection ready: `{"type": "connected", "channelId": 12345}`
- Close notification: `{"type": "close", "reason": "normal|error|agent_disconnect"}`

## Path parameters

- `token` string, uuid, required

## Other responses

- `101` — Switching Protocols - WebSocket connection established successfully. After upgrade, the connection enters WebSocket mode for bidirectional data transfer. A JSON message `{"type": "connected", "channelId": N}` is sent after successful upgrade.
- `401` — Unauthorized - Token is invalid, expired, or already used. WebSocket close frame with code 1008 (Policy Violation) is sent.

---

[API](https://skmtc.net/netxms/apis/netxms-api.md) · [All operations](https://skmtc.net/netxms/apis/netxms-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/netxms/netxms-api/versions/14d93e5115dd/schema)
