WebSockets allow for continuous, two-way communication over a single connection, well suited for real-time applications such as triggers in Dise.
The WebSocket Trigger app makes it easy to activate triggers in Dise based on data received from a websocket, with no coding required on the Dise side. The app is designed to run in the background, and will establish a connection to the websocket specified and continuously listen to any data coming in.
You can specify a text string to search for, which will activate the trigger when received. In fact, it is a regular expression (regex), which means you can do advanced pattern matching of incoming data. You can even customize the app to activate any number of triggers, based on what data comes in from the websocket!
In many use cases, you will want to connect to a websocket somewhere on the Internet or in the customer’s network. Since the connection is established outgoing from the app running on the player, it will not require any firewall changes, as long as the standard http/https ports (80/443) are being used.
An alternative is to use the “echoing” websocket hosted by the Dise player itself on localhost port 6556 (Windows and Linux only). This allows other applications on the same device or on the local network to communicate directly and activate triggers on the player, without depending on a websocket in the cloud.
Installing and using the app
Create your trigger(s) in the CMS, add it to the scenario(s) you want to trigger
Download the app here:
If you want to activate more than one trigger from the same websocket, read below on how to customize the app. Otherwise, you can use it out of the box without any customizations.
Upload the zip (including any changes to the json files) as a template in the CMS.
Create an invisible / background layer with a channel and playlist.
Create a message and fill out the fields as follows:
WebSocket address (*)
The url of the websocket, including protocol (ws or wss)
Examples:
wss://my.domain.com/test (wss = secured by TLS)
ws://localhost:6556/test (the local Dise player websocket)
Trigger name (*)
The name of the Dise trigger to activate, as created in step 1. above
Match for active (*)
Regular expression for text to match to activate the trigger. Note that regular expressions are case-insensitive
Examples:
hello - matches the string “hello”
. (a dot charcter) - wildcard, matches any string
Match for inactive
Once the trigger has been activated, it stays active until deactivated. By filling out this field with a regular expression, the trigger will be deactivated when a matching text is received
Active timeout (*)
A number of seconds, after which the trigger will be deactivated automatically. Set to 0 for no timeout (then you need to provide “Match for inactive”)
(*) mandatory
Use the preview function in the message editor to test the websocket connection and the activation/deactivation conditions in real time! (This works with websockets in the cloud, but not with the localhost websocket)
.png?sv=2022-11-02&spr=https&st=2025-12-06T05%3A07%3A45Z&se=2025-12-06T05%3A20%3A45Z&sr=c&sp=r&sig=qcWOupSvccEeH7Z0b5VUh6IrTzEz7ahqGsAc6IXbzfw%3D)
Publish the message to the playlist.
Customizing the app
To customize the app, unpack the zip file, edit the template.json file as described below, then create a new zip with all files.
To add more triggers, duplicate the four fields Trigger name, Match for active, Match for Inactive, and Active timeout for every additional trigger. Edit the file template.json, and copy and paste the following field definitions for adding trigger number 2:
{ "type": "text", "key": "2_triggerName", "caption": "2. Trigger name", "default": "", "required": false }, { "type": "text", "key": "2_activeExp", "caption": "Match for Active (in RegEx format)", "default": ".", "required": true }, { "type": "text", "key": "2_inactiveExp", "caption": "Match for Inactive (in RegEx format)", "default": "", "required": false }, { "type": "number", "key": "2_timeoutSeconds", "caption": "Active timeout (sec)", "default": 10, "required": true }
To add more triggers, copy and paste again but replace all 2’s with 3, 4, ….