Paolo Selesti
Paolo Selesti

Reputation: 1

mqtt client active on the smart device to be usable

can someone to confirm that in order to use MQTT protocol, the APP on the smart device (Ios or Android) embedding MQTT client code, must be active? If so, how can i wake-up the App from my remote server to enable mqtt conversation? Maybe a push notification should alert the smartphone user to open the APP because some important messages are outstanding for him?

Upvotes: 0

Views: 80

Answers (2)

ppatierno
ppatierno

Reputation: 10065

The main thing is that the TCP socket (so the connection) between client and broker must be active so that broker can push messages to the client (as subscriber to some topics).

The only way to handle "disconnected" scenario from the client side is to connect to the broker with "clean session" at false. In this case, the broker will store all messages for that client if it's offline and then send them when it'll be online.

Paolo

Upvotes: 0

hardillb
hardillb

Reputation: 59608

For Android the app can start a service that will run in the background and receive published messages all the time.

For IOS you will need to wake the application up to get it to connect to the broker, the usual approach to this is to use the Apple Push Notification Service to wake the app up.

Upvotes: 1

Related Questions