transistorsoft / flutter_background_fetch

Periodic callbacks in the background for both IOS and Android. Includes Android Headless mechanism

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

luohao123 opened this issue · comments

commented

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.

commented

@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.

commented

@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”.

commented

@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.

commented

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.