...
You can listen for changes in the operating mode through the Sockets.OP_MODE_RECEIVED
event listener callback on the SDK:
Code Block |
---|
this.gumbandSDK.on(Sockets.OP_MODE_RECEIVED, (payload) => {
console.log(`received op mode: ${JSON.stringify(payload)}`);
if(payload.value) {
console.log('OP mode now on');
} else {
console.log('OP mode now off');
}
}); |
...
There is no event listener for when a status changes, since statuses are one-way communications from the exhibit to the Gumband cloud. A status can be updated through the setStatus
function in the SDK. For example, imagine that a screen should toggle on and off according to the operation mode:
Code Block |
---|
this.gumbandSDK.on(Sockets.OP_MODE_RECEIVED, (payload) => { if(payload.value) { this.gumbandSDK.setStatus('screen-status', 'Digital Signage'); this.turnScreenOn(); } else { this.gumbandSDK.setStatus('screen-status', 'Off'); this.turnScreenOff(); } }); |
Note that screen-status
matches the ID of the status defined in the manifest.
Triggering Events with Controls
...
would configure controls for the following exhibit instance in the Gumband UI:
...
Controls can be thought of as the inverse of statuses: they are one-way communications from the Gumband cloud to the exhibit. You can listen for a control trigger through the Sockets.CONTROL_RECEIVED
event listener callback on the SDK:
...
Since settings are two way communications, they can be set by the exhibit through the setSetting
function in the SDK, and a setting change event from the Gumband cloud can be listened for through the Sockets.SETTING_RECEIVED
event listener callback:
Code Block |
---|
exhibitActionThatTriggersSettingChange(settingId) { this.gumbandSDK.setSetting(settingId); } this.gumbandSDK.on(Sockets.SETTING_RECEIVED, (payload) => { console.log(`${payload.id} setting updated to: ${payload.value}`); this.updateFrontendFromSettings(); }); |
...
Measure User Interactions
Recording events to measure user interaction is easy with the Gumband SDK. Simply use the this.gumbandSDK.event.create(eventName: string, data: any)
function to dispatch new events to the Gumband cloud. For example, the following will dispatch 16 fake button press events:
Code Block |
---|
createFakeButtonPressEvents() {
for (let i=0; i<10; i++) {
await gb.event.create("Blue Button Press", {});
}
for (let i=0; i<5; i++) {
await gb.event.create("Red Button Press", {});
}
await gb.event.create("Yellow Button Press", {});
}; |
which would result in the following events in the Gumband UI:
...
Dispatch Email Custom Notifications
When a critical component of your exhibit goes down, you want know right away. Gumband has email notifications built-in for a number of use cases, such as Operation Mode change and the Exhibit going offline/online, but you can also define your own custom email notifications with the this.gumbandSDK.notifications.email(customMessage: string)
:
Code Block |
---|
thirdPartyIntegration.on('error', () => {
this.gumbandSDK.notifications.email("An error occurred with the third party integration");
}); |
Each Gumband user can individually subscribe to the built-in notifications and any custom notifications you dispatch in the Exhibit Notifications tab:
...