External systems and individual IoT devices (hereafter collectively called "devices") can communicate with our application. As each device type is different, you are free in what your devices send and what you want to return to them. To orchestrate communication, you should define an event handler for each device type.
The event handler is called when:
The event handler can:
See the interfaces EventWithoutResponse
and IncomingRequestEvent
for more details.
The event handler function should:
be written in Typescript,
be named handle
have the following signature:
function handle(args: ArgumentsForIncomingRequestEvent, exec: Exec): IncomingRequestResponse;
function handle(args: ArgumentsForEventWithoutResponse, exec: Exec): void;
function handle(args: Arguments, exec: Exec): IncomingRequestResponse | void {}
An example event handler can be inserted using the toolbar above the code editor.
You can inspect activity on this event handler by going to "Activity" in the connectivity environment and filtering "Device Type" on the name chosen for this device type.