Updated Date: 07/07/2026
Configuring MQTT over WebSockets
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
The Message Queuing Telemetry Transport (MQTT) over WebSocket is enabled to offer a filter when MQTT is encapsulated using WebSockets, such as MQTT iRule based enrichment and inspection. In addition to the current behavior of the WebSockets filter, support for the following is introduced:
- End-to-End WebSocket for MQTT Payload: Support for MQTT protocol profile over WebSockets on both client-side and server-side connections.
- WebSocket Termination for MQTT Payload: Supports WebSocket connection termination on client-side.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Complete the following tasks for configuring MQTT over WebSocket when both client-side and server-side are using WebSocket encapsulation:
- Creating an End-to-End WebSocket profile
- Creating an iRule for enabling WebSocket Payload processing as an alternate
- Creating a Client SSL profile
- Creating a virtual server for MQTT over WebSockets
- Viewing MQTT statistics
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Use this task to create a WebSocket profile.
-
On the Main tab, click Local Traffic > Profiles > Services > WebSockets.
-
Click Create.
The new WebSocket Profile screen opens.
-
In the Name field, type a unique name for the profile.
-
In the Payload Processing Mode field, select
End-To-End. -
In the Payload Protocol Profile field, select
mqttprofile. -
Click Finished.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
An iRule that enables WebSocket payload processing for MQTT is required. Without iRule, the WebSocket payload will be processed as opaque binary data and MQTT iRule Events will not be triggered.
Use this task to create an iRule for enabling WebSocket payload processing.
-
On the Main tab, click Local Traffic > iRules > iRule List.
The iRule List screen opens, displaying any existing iRules.
-
Click Create.
The New iRule screen opens.
-
In the Name field, type a unique name for the iRule.
The full path name of the iRule cannot exceed 255 characters.
-
In the Definition field, type an iRule that enables WebSocket payload processing when MQTT is detected in request.
Following are iRule examples:
when WS_REQUEST { switch [WS::request protocol] { mqtt { WS::payload_processing enable } } }when WS_REQUEST { if { [HTTP::path] starts_with "/mqtt" } { WS::payload_processing enable } } -
Click Finished.
The new iRule appears in the list of iRules on the system.
The BIG-IP system includes the iRules for enabling WebSocket payload processing.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
This task is an alternative for Creating an iRule for enabling WebSocket Payload processing task.
Use BIG-IP LTM policy to direct traffic in accordance with rules, which are applied as determined by the specified strategy, conditions, and actions. Local traffic policies that have been upgraded from BIG-IP software version 12.0, or earlier, appear in the Published Policies list.
Use this task to create a LTM policy for enabling WebSockets payload processing.
-
On the Main tab, click Local Traffic > Policies > Policy List.
The Policies List screen opens, displaying any existing policies.
-
Click Create.
The New Policy screen opens.
-
In the Policy Name field, type a unique name for the policy.
-
Click Create Policy.
The Draft Policy screen opens.
-
In the Rules section, click Create.
The Properties screen opens.
-
In the Name field, type a unique name for the rule.
-
In the Match all of the following conditions section, click the + button and create an HTTP request or WebSocket request based condition.
For example,
WebSocketprotocolis any ofmqttatwebsocket requesttime. -
In the Do the following when the traffic is matched section, click the + button and create an action.
For example,
Enablewebsocket payload processingatwebsocket requesttime. -
Click
Save.The Draft Policy screen opens.
-
From the drop-down at Save Draft, select Save and Publish Policy.
The Policy List screen opens, the created policy will be listed under Published Policies section.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Create a Client SSL profile to authenticate and decrypt/encrypt client-side application traffic.
-
On the Main tab, click Local Traffic > Profiles > SSL > Client.
The Client SSL profile list screen opens.
-
Click Create.
The New Client SSL Profile screen opens.
-
Configure all profile settings as needed.
-
Click Finished.
After creating the Client SSL profile and assigning the profile to a virtual server, the BIG-IP system can apply SSL security to the type of application traffic for which the virtual server is configured to listen.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Before creating a virtual server, verify that you have created the pool to which you want this virtual server to send traffic.
When you create a virtual server, you specify a destination IP address and service port. All other settings on the virtual server have default values. Update the default values of any settings to suit the requirement.
-
On the Main tab, click Local Traffic > Virtual Servers.
The Virtual Server List screen opens.
-
Click Create.
The New Virtual Server screen opens.
-
In the Name field, type a unique name for the virtual server.
-
From the Type list, retain the default, Standard.
-
In the Destination Address/Mask field:
- If you want to specify a single IP address, confirm that the Host button is selected, and type the IP address in CIDR format.
- If you want to specify multiple IP addresses, select the Address List button, and confirm that the address list that you previously created appears in the box.
The supported format is address/prefix, where the prefix length is in bits. For example, an IPv4 address/prefix is
10.0.0.1or10.0.0.0/24, and an IPv6 address/prefix isffe1::0020/64or2001:ed8:77b5:2:10:10:100:42/64. When you use an IPv4 address without specifying a prefix, the BIG-IP system automatically uses a/32prefix.
Note: The IP address or addresses for this field must be on the same subnet as the external self-IP address.
-
In the Service Port field, type the port number at which WebSocket service is required.
-
From the Configuration list, select Advanced.
-
For the HTTP Profile (Client) setting, select the name of an HTTP profile from the list.
-
For the SSL Profile (Client) setting, from the Available list, select the name of the Client SSL profile you previously created and move the name to the Selected list.
-
In the WebSocket Profile field, select the name of the WebSocket profile you previously created.
-
Configure any other settings that are required.
-
In the Resources section, in the iRules or Policies settings, from the Available list, select the name of the iRule or the LTM policy that you have previously created and move the name into the Enabled list by clicking <<.
-
In the Default Pool list, select the name of the pool that you created previously.
-
Click Finished.
You now have a virtual server that listens for application traffic and acts according to the values configured within the virtual server.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Ensure that an MQTT profile is assigned to at least one virtual server.
You can see how the BIG-IP is handling MQTT messages by viewing statistics per MQTT profile.
-
On the Main tab, click Statistics > Module Statistics > Local Traffic.
The Local Traffic statistics screen opens.
-
From the Statistics Type list, select Profiles Summary.
-
In the Details column for the MQTT profile, click View to display detailed statistics about MQTT messages.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Redirect the WebSocket traffic to an internal virtual server to achieve WebSocket termination for MQTT payload.
Complete the following tasks for configuring WebSocket termination when client-side is using WebSocket encapsulation:
- Creaeting a WebSocket Termination profile
- Creating a Client SSL profile
- Creating an iRule for enabling payload processing and specifying internal virtual server
- Creating an internal virtual server for MQTT
- Creating a virtual server for MQTT over WebSockets
- Viewing MQTT statistics
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Use this task to create a WebSocket profile.
-
On the Main tab, click Local Traffic > Profiles > Services > WebSockets.
-
Click Create.
The new WebSocket Profile screen opens.
-
In the Name field, type a unique name for the profile.
-
In the Payload Processing Mode field, select
Termination. -
Click Finished.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Create a Client SSL profile to authenticate and decrypt/encrypt client-side application traffic.
-
On the Main tab, click Local Traffic > Profiles > SSL > Client.
The Client SSL profile list screen opens.
-
Click Create.
The New Client SSL Profile screen opens.
-
Configure all profile settings as needed.
-
Click Finished.
After creating the Client SSL profile and assigning the profile to a virtual server, the BIG-IP system can apply SSL security to the type of application traffic for which the virtual server is configured to listen.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
An iRule that enables WebSocket payload processing and specifies WebSocket payload internal virtual server is required. Without iRule, the WebSocket will not be terminated and server will continue to receive WebSocket encapsulated traffic.
Use this task to create an iRule for enabling WebSocket payload processing and specifying WebSocket payload internal virtual server.
-
On the Main tab, click Local Traffic > iRules > iRule List.
The iRule List screen opens, displaying any existing iRules.
-
Click Create.
The New iRule screen opens.
-
In the Name field, type a unique name for the iRule.
The full path name of the iRule cannot exceed 255 characters.
-
In the Definition field, type an iRule that enables WebSocket payload processing when MQTT is detected in request.
Following are iRule examples:
when WS_REQUEST { switch [WS::request protocol] { mqtt { WS::payload_processing enable WS::payload_ivs /Common/my_mqtt_ivs } } }when WS_REQUEST { if { [HTTP::path] starts_with "/mqtt" } { WS::payload_processing enable WS::payload_ivs /Common/my_mqtt_ivs } } -
Click Finished.
The new iRule appears in the list of iRules on the system.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Use this task to create an internal virtual server for MQTT.
Note: The internal virtual server will receive traffic only when parent virtual server sends data to it.
-
On the Main tab, click Local Traffic > Virtual Servers.
The Virtual Server List screen opens.
-
Click Create.
The New Virtual Server screen opens.
-
In the Name field, type a unique name for the virtual server.
-
From the Type list, select Internal.
The screen displays internal virtual server configuration options.
-
From the Configuration list, select Advanced.
-
In the MQTT field, select the MQTT profile.
-
Configure any other settings that are required.
-
In the Resources section, in the iRules setting, from the Available list, select the name of any MQTT iRule that you have previously created and move the name into the Enabled list by clicking <<.
-
In the Default Pool list, select the name of the pool that you created previously or click the + button to create a new pool.
-
Click Finished.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Before creating a virtual server, verify that you have created the pool to which you want this virtual server to send traffic.
When you create a virtual server, you specify a destination IP address and service port. All other settings on the virtual server have default values. Update the default values of any settings to suit the requirement.
-
On the Main tab, click Local Traffic > Virtual Servers.
The Virtual Server List screen opens.
-
Click Create.
The New Virtual Server screen opens.
-
In the Name field, type a unique name for the virtual server.
-
From the Type list, retain the default, Standard.
-
In the Destination Address/Mask field:
- If you want to specify a single IP address, confirm that the Host button is selected, and type the IP address in CIDR format.
- If you want to specify multiple IP addresses, select the Address List button, and confirm that the address list that you previously created appears in the box.
The supported format is address/prefix, where the prefix length is in bits. For example, an IPv4 address/prefix is
10.0.0.1or10.0.0.0/24, and an IPv6 address/prefix isffe1::0020/64or2001:ed8:77b5:2:10:10:100:42/64. When you use an IPv4 address without specifying a prefix, the BIG-IP system automatically uses a/32prefix.
Note: The IP address or addresses for this field must be on the same subnet as the external self-IP address.
-
In the Service Port field, type the port number at which WebSocket service is required.
-
From the Configuration list, select Advanced.
-
For the HTTP Profile (Client) setting, select the name of an HTTP profile from the list.
-
For the SSL Profile (Client) setting, from the Available list, select the name of the Client SSL profile you previously created and move the name to the Selected list.
-
In the WebSocket Profile field, select the name of the WebSocket profile you previously created.
-
Configure any other settings that are required.
-
In the Resources section, in the iRules or Policies settings, from the Available list, select the name of the iRule or the LTM policy that you have previously created and move the name into the Enabled list by clicking <<.
-
In the Default Pool list, select the name of the pool that you created previously.
-
Click Finished.
You now have a virtual server that listens for application traffic and acts according to the values configured within the virtual server.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})
Ensure that an MQTT profile is assigned to at least one virtual server.
You can see how the BIG-IP is handling MQTT messages by viewing statistics per MQTT profile.
-
On the Main tab, click Statistics > Module Statistics > Local Traffic.
The Local Traffic statistics screen opens.
-
From the Statistics Type list, select Profiles Summary.
-
In the Details column for the MQTT profile, click View to display detailed statistics about MQTT messages.
or perform task [Creating a LTM policy for enabling WebSocket Payload processing](configuring_mqtt_over_websockets.md" >}})