So actually it might be interesting to drop the support for QoS1. That will save quite some space. The only problem might be that clients which actually do require QoS1 will never receive QoS1 packets from the micro-mqtt client because the QoS of a packet never upgrades. It can only downgrade.
WebSockets, or something else... Nice thought. I already wanted to get rid of the dependency on 'net'. Need to think about a more generic interface.
Question: is it fair to say that the actual usage of the running code = process().memory.usage -/- process().memory.history?
I already did some optimizations. Currently, if the following client is up and running:
"use strict";
function onInit() {
var Client = require('micro-mqtt').Client;
var client = new Client({
host: '192.168.2.4',
clientId: 'espruino',
username: 'username', password: 'password',
will: {
topic: 'rovale/espruino/status',
message: 'offline',
qos: 1,
retain: true
}
});
client.on('connected', function () {
client.subscribe('rovale/#', 1);
client.publish('rovale/espruino/status', 'online', 1, true);
});
client.on('publish', function (pub) {
console.log('on publish');
console.log(pub);
});
client.on('debug', function (debug) {
console.log('[debug] ' + debug);
});
client.on('info', function (info) {
console.log('[info] ' + info);
});
client.on('error', function (error) {
console.log('[error] ' + error);
});
client.connect();
global.client = client;
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
So actually it might be interesting to drop the support for QoS1. That will save quite some space. The only problem might be that clients which actually do require QoS1 will never receive QoS1 packets from the micro-mqtt client because the QoS of a packet never upgrades. It can only downgrade.
WebSockets, or something else... Nice thought. I already wanted to get rid of the dependency on 'net'. Need to think about a more generic interface.
Question: is it fair to say that the actual usage of the running code =
process().memory.usage -/- process().memory.history
?I already did some optimizations. Currently, if the following client is up and running:
it shows:
I started off with:
So that is already quite an improvement. Now I want to keep track of possible memory leaks, for instance after losing the network connection.