Startup and Shutdown Event Scripts
Startup and Shutdown events run, naturally, whenever a session starts or ends. In each case, the gateway will have access to the session object associated with the section, complete with all session properties.
When designing a startup or shutdown event script:
- Custom session properties can be used to pass any additional information to the gateway, or, in the case of a startup script, to pass information to the newly opening session. You can configure custom session properties from the Page Configuration dialog, by clicking on the Settings icon in the Designer.
- A shutdown event script will run specifically when a session is ending. This happens specifically when any of the following events occur:
- The session closes due to a timeout. Session timeout is configurable in the Perspective > General section of Project Properties in the Designer
- The user is no longer authorized to run the session.
- The redundancy system determines that the Gateway is inactive.
- The licensing system no longer permits the user to run the session.
- The project is no longer runnable.
- The project is deleted.
Closing the browser tab with the session will not immediately close the session; the session must first time out.
Startup and Shutdown Example
This example will record the session start and end time to the database.
Test the Example
To test the example, open the Perspective App on your mobile device and load the project.
Native App Event Scripts
When the Perspective App is running on a mobile device, it enables users to use tools available on the device, such as GPS location data, the camera, or the accelerometer. The remaining session events are designed specifically to handle the three Native App Actions.
Bluetooth Data Received
The Bluetooth Data Received event is only used when a session is running in a native application and it has received bluetooth advertising data. This session event script sends Bluetooth advertising data to Perspective. It supports iBeacon and Eddystone formats.
- Eddystone will work on iOS and Android
- iBeacon on iOS requires user to specify the specific region (iBeacon UUID) located on session props bluetooth.config.iBeaconRegion.
Bluetooth "Advertising Data" is the name of the communication data according to the Bluetooth spec. There is no connection to advertising as an industry.
|session||An object that references the Project Session|
List of buffered advertising data. The data comes in as a data object, which has various parts. The following is example output.
The Message Handler scripts will run whenever the session receives a message .
Replace the sentence above with the following:The Message Handler scripts will run whenever the session receives a message
from system.util.sendMessage or system.util.sendRequest. Note that these types of message handlers are different than component-based message handlers, which are accessed with system.perspective.sendMessage. Session Message Handlers can not be called by system.perspective.sendMessage.
|session||The Perspective Session that is handling this message.|
A dictionary that holds the objects passed to this message handler.
Need tech person to help with an example