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 Virtual Host.
The following prerequisites apply:
Note: If you do not have an account, see Create an 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
F5 Distributed Cloud virtual host requires an 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: Navigate to the Routes page.
- Select the
- Select the desired namespace from the
- Navigate to
Step 2: Begin to add a route.
- Enter a name for the route. Optionally set labels and add a description.
- In the
List of routes section, click
Add Itemto add a new route to the list.
- In the
Actionssection, make sure
Destination Listis set as the action, and then click
Step 3: Set the destination origin pools (clusters).
Add Itemin the
Destination Origin pools (clusters)list under the
Origin Pools and Wightssection.
- Select an existing cluster from the
Clusterdrop-down list, or click the
create a new clusterat the bottom of the drop-down list.
- Enter a weight for this cluster if there are to be multiple clusters.
Add Itemto apply the cluster to the destination list.
Step 4: Configure the destination actions.
- In the
Destination Actionssection, turn on the
Show Advanced Fieldstoggle.
- Turn on the
Show Advanced Fieldstoggle in the
- Check the
Use Websocketcheckbox and click
- Optionally, enter a value in milliseconds in the
Timeoutfield. The websocket connection gets closed after the set time period of idle time.
- Optionally, configure a
retrypolicy. The default is 1 retry with no conditions or changes.
Step 5: Complete the route.
Applyto save the destination list.
Add Itemto save the actions.
Applyto save the list of routes.
Save and Exitto save the route.
Note: Configure all the other fields as necessary. For information on all fields, see Create Route.
Create Advertise Policy and Virtual Host
Distributed Cloud virtual host requires an advertise policy to specify where and how the service is advertised.
Step 1: Create an advertise policy.
- Use 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.
- Create a virtual host of type HTTP Proxy or HTTPS Proxy. Use the instructions in the Create Advertise Policy chapter of Create and Advertise a Virtual Host guide.
- Apply the route created in the Create Route with Websocket chapter.