Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Client be disconnected when keepAliveInterval more than 10 secs

I tried Mosquitto and ActiveMQ, the code is simple:

        MqttClient client = new MqttClient("tcp://10.18.93.54:1883", "charles_subscribe");
        MqttConnectOptions opts = new MqttConnectOptions();
        opts.setKeepAliveInterval(10);
        opts.setCleanSession(true);

        client.setCallback(this);
        client.connect(opts);
        client.subscribe(topic);

        try {
            System.in.read();
        } catch (IOException e) {
            //If we can't read we'll just exit
        }

        // Disconnect the client
        client.disconnect();

When keepAliveInterval more than 10 secs, the server will kill the connection after about 5 mins.
But the Mosquitto library for C is worked.

Back to the top