Mashup Builder > Mashups > Updating Properties Automatically in a Mashup
Updating Properties Automatically in a Mashup
You can configure a mashup to use websockets and to receive property updates automatically using the GetProperties service. In the Data Properties panel, when the Automatically update values when able check box is selected and the mashup is viewed, the mashup run time creates a websocket connection with the ThingWorx Platform and subscribes to the properties that are bound to widgets. When a property changes, the mashup receives the new value and processes it as though the service had been invoked. In ThingWorx 9.1.1 and later, the Connected and Disconnected events are available for the GetProperties service. These events are available when the Automatically update values when available option is enabled and they fire based on the status of the WS connection.
In order to create this websocket connection, ThingWorx generates a temporary application key (named TwxRuntimeKey_<Username>_<Unique_UUID> (in previous releases, it was named TwxRuntimeKey_Username) to bind with. The bind is needed in order to subscribe to the properties; otherwise, the event data cannot be sent back to the browser. The temporary application key expires after 15 seconds and is deleted after 30 seconds.
* 
While this temporary key is deleted after 30 seconds, if the ThingWorx Platform is shut down before 30 seconds elapses, this expired key may remain on the server. The next time that user views a websocket-enabled mashup, the old application key will get deleted and a new one will be generated.
* 
If an Auto Refresh function is bound to GetProperties and the browser supports websockets, the Auto Refresh function will not call GetProperties, but will still call any other services it is associated with. For more information on the Auto Refresh function, see Auto Refresh function.
Showing A Message for Invalid Subscriptions
In ThingWorx 9.4 or later, you can notify users when a subscription becomes invalid by enabling the Show Subscription Message check box on the Data Properties panel of the GetProperties service. A subscription becomes invalid under one of the following conditions:
A subscribed property is removed.
The subscribed Thing is deleted.
The required permissions are not available.
When one of these conditions occur at run time, a status message is displayed in the mashup to indicate to the user that the subscription is invalid. Additional information about the invalid subscriptions are available in the ThingWorx Application Logs.
Was this helpful?