IPWorks IoT 2020 Kotlin Edition

Questions / Feedback?

SendResponse Method

Sends a response for a given pending request to the corresponding client.

Syntax

public fun sendResponse(requestId: String?)

Remarks

This method sends a response for the request in the PendingRequests collection identified by RequestId. The ResponseData property specifies the data that will be sent in the response, and the ResponseCode property specifies the response code. If the ResponseContentFormat and/or ResponseETag properties are non-empty, their values will be used to include Content-Format and Etag options in the response (respectively). Any additional options present in the ResponseOptions collection will be included as well.

If the UseConfirmableMessages property is enabled when this method is called, the component will automatically retransmit the response message (if necessary) until it receives confirmation from the client that it was received. Note that the retransmission period is not infinite; eventually the component will assume that the message is undeliverable and time out the response. The ResponseComplete event will fire once the message receipt is confirmed (or once the retransmission period elapses).

If the UseConfirmableMessages property is disabled, the ResponseComplete event will fire immediately instead, since there is no way to know whether the client received the response.

Note: This method can only be called when the component is operating in server mode (i.e., when the Listening property is enabled).

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks IoT 2020 Kotlin Edition - Version 20.0 [Build 7941]