You are reading a single comment by @Rovale and its replies. Click here to read the full conversation.
  • 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;
    }
    

    it shows:

    >process.memory();
    ={ "free": 626, "usage": 774, "total": 1400, "history": 58 }
    

    I started off with:

    >process.memory();
    ={ "free": 521, "usage": 879, "total": 1400, "history": 58 }
    

    So that is already quite an improvement. Now I want to keep track of possible memory leaks, for instance after losing the network connection.

About

Avatar for Rovale @Rovale started