Introduced type-safe arguments for the functions passed to the MqttMessageProcessor constructor. This exposes that there is a problem in the MqttMessageProcessor.setConfig() method (missing subResource). Currently I have added a TODO there.
The functions sendResource and sendMetaData are now passed via arrow functions in the constructor of the MqttMessageProcessor. This fixes the exception that I got when calling the sendResource method from the MqttMessageProcessor:
async sendResource(resource, messageId, subResource, filter, page = 0, perPage = 0) {
// throws exception: preparePayload type not found
//
// the reason is that the this-keyword points to MqttMessageProcessor and a
// method MqttMessageProcessor.preparePayload does not exist
const validatedPayload = await this.preparePayload(resource, subResource, filter);
...
}
Introduced type-safe arguments for the functions passed to the
MqttMessageProcessor
constructor. This exposes that there is a problem in theMqttMessageProcessor.setConfig()
method (missing subResource). Currently I have added a TODO there.The functions
sendResource
andsendMetaData
are now passed via arrow functions in the constructor of theMqttMessageProcessor
. This fixes the exception that I got when calling thesendResource
method from theMqttMessageProcessor
:See also https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback