transistorsoft/flutter_background_fetch

hi, how to keep a mqttclient runing in background with this lib/?

Closed this issue · 9 comments

what I need is just runing mqtt client in background, is there any easily way to do this in this lib?

This lib has nothing at all to do with any kind of connection to a server.

this is merely a periodic callback locally on the device. What you choose to do within your callback is purely up to you.

@christocracy I know, what I ask, is is that possible call the MqttClient class inside the callback (which is the whole module class in my app), and then send notifictions as well as saving the message to sql once the new message got?

What you do in your own callback is up to you. The plug-in has no opinion about what you do in your callback function.

@christocracy thanks, I think it twice, how can I make sure my mqtt client keep alive inside this callback function? to restart it in callback?

Your callback has a finite time to run (eg iOS 30s). You must call .finish(taskId) before your time expires.

you don’t get to “keep things alive”.

@christocracy when i call MqttClient.reconnnect() inside callback func, does the mqtt client can be bring up even though it might disconnect for another 10 minutes?

I have no idea. I have no experience with sockets.

what you do in your callback is your responsibility.

it's same as sockets, may i ask how do u deal with sockets?

Did you read what I said?

I have no experience with sockets.