{
  "openapi": "3.0.1",
  "servers": [{ "url": "wss://apis.<domain>" }],
  "info": {
    "title": "Connhex WS",
    "description": "WebSocket API for receiving messages through communication channels.",
    "version": "1.5.0"
  },
  "paths": {
    "/iot/ws/channels/{id}/messages/{subtopic}": {
      "get": {
        "summary": "Establishes WebSocket connection with channel and subtopic",
        "description": "Establishes WebSocket connection with the specified channel and subtopic.\nThis endpoint is used to establish a connection that can be used to receive\nreal-time messages from a specific subtopic within a channel.\n",
        "tags": ["Websocket"],
        "parameters": [
          { "$ref": "#/components/parameters/ID" },
          {
            "name": "subtopic",
            "in": "path",
            "description": "Subtopic to subscribe to, can include multiple segments",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "101": {
            "description": "WebSocket connection established successfully."
          },
          "400": {
            "description": "Bad request due to empty channel ID, malformed subtopic, or malformed entity."
          },
          "401": {
            "description": "Missing or invalid access token provided."
          },
          "403": {
            "description": "Forbidden access to the requested channel."
          },
          "404": { "description": "The specified channel was not found." }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ID": {
        "name": "id",
        "description": "Unique channel identifier.",
        "in": "path",
        "schema": { "type": "string", "format": "uuid" },
        "required": true
      }
    },
    "responses": {
      "ServiceError": {
        "description": "Unexpected server-side error occurred."
      }
    },
    "securitySchemes": {
      "$ref": "../../../common.json#/components/securitySchemes"
    }
  },
  "security": [{ "thingKey": [] }]
}
