Configure WebSocket Support
On This Page:
This document provides instructions on how to enable websocket-based communication for your application. WebSocket provides a persistent connection between client and server over HTTP or HTTPS.
Using the instructions provided in this guide, you can enable websocket connection for your services provisioned using a virtual host. For more information on virtual hosts, see Volterra Virtual Host.
The following prerequisites apply:
Note: If you do not have an account, see Create a Volterra Account.
A virtual host acting as a proxy for a service
Note: If you do not have a virtual host configured, see Create a Virtual Host.
Enabling websocket-based communication requires performing the following sequence of actions:
|Create Endpoint and Cluster||Create objects required for virtual host.|
|Create Route with Websocket||Create route enabled for websocket communication.|
|Create Advertise Policy and Virtual Host||Create advertise policy and virtual host with the route and policy.|
Note: You can enable websocket communication while creating the route or you can edit an existing route to enable websocket support.
Create Endpoint and Cluster
Volterra virtual host requires to create endpoint and associated cluster where the service is available or discovered. For instructions on creating endpoint and cluster, see Create Endpoint and Create Cluster respectively.
Create Route with Websocket
Perform the following steps to create a route enabled with websocket support.
Step 1: Select the namespace where you want to create the virtual host. Select
Manage from the configuration menu and
Routes from the options pane. Click
Add route to load the route configuration form.
Step 2: Enter a name and set labels as per your choice. Optionally, add a description.
Step 3: Click
Add route in the
Routes field and select
Destination List for the
Route action field.
Step 4: Click
Add destination and add the cluster created in the Create Endpoint and Cluster chapter.
Step 5: Click
Websocket Configuration to load websocket configuration form. Select the
Use Websocket checkbox to enable websocket connection.
Step 6: Optionally, enter a value in milli seconds in the
Idle Timeout field. The websocket connection gets closed after the set time period.
Step 7: Optionally, enter a value in the
Maximum Connection Attempts field. The default value is 1.
Step 8: Click
Add route to complete route creation.
Note: Configure all the other fields as per your need. For information on all fields, see Create Route.
Create Advertise Policy and Virtual Host
Volterra virtual host requires to create an advertise policy to specify where and how the service is advertised.
Step 1: Create an advertise policy as per the instructions in the Create Advertise Policy chapter of Create and Advertise a Virtual Host guide.
Step 2: Create a virtual host of type HTTP Proxy or HTTPS Proxy. Apply the route created in the Create Route with Websocket chapter.
Note: Create the virtual host as per the instructions in the Create Advertise Policy chapter of Create and Advertise a Virtual Host guide.