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 when able 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.
Was this helpful?