Deploying a WebSocket API in Choreo Connect¶
You can deploy a WebSocket type API in Choreo Connect using Choreo Connect with WSO2 API Manager as a Control Plane.
Choreo Connect with WSO2 API Manager as a Control Plane¶
Follow the instructions below to use Choreo Connect with WSO2 API Manager as the Control Plane to deploy a WebSocket type Streaming API via the Publisher Portal in WSO2 API Manager:
Before you begin
This guide assumes that you already have a Choreo Connect instance that is up and running. If not, checkout the Quick Start Guide on how to install and run Choreo Connect. To learn more about Choreo Connect, have a look at the Overview of Choreo Connect.
Limitations compared to WSO2 API Manager 4.0.0
WSO2 API Manager allows users to provide multiple topics per Websocket API. In contrast, Choreo Connect does not support topics currently. The inbound request URL follows the structure
<choreo-connect-gateway-url>/<API-Context>/<Version>. And internally, the request will be forwarded to the API's endpoint URL with no topic appended to the end of the URL.
Step 1 - Create a WebSocket API in API Manager¶
For instructions on how to create a WebSocket API, see Create a WebSocket API.
Step 2 - Deploy the API in the Choreo Connect environment¶
For more information on deploying the API in Choreo Connect, see Deploy API.
Step 3 - Generate an Access Token to invoke the API¶
By default, the WebSocket API is protected by an OAuth2 token.
For more information on generating a JWT Access token, see Get a Test Key to Invoke an API.
Step 4 - Invoke the API using a WebSocket client¶
The WebSocket API exposed via Choreo Connect can be invoked by using a WebSocket client. The JWT token should be set as the Authorization header in the initial WebSocket handshake request.
The same ports 9095 (HTTPS) and 9090 (HTTP) are used for WebSocket APIs.
Invoke the WebSocket API by carrying out Step 4 in the Create and Publish a WebSocket API tutorial.Top