Open ghost opened 6 years ago
are u using different ids for each device?
Same client id ?
This is not a solution for the current library. I have found a workaround which will allow you to bypass doze while not using FCM/GCM. It won't be real-time but your messages will be sent.
Now that we're done with the disclaimer.
Use a broker which supports offline messages. The broker will store your messages and send them once the client comes online. This might happen either when your app gets in the foreground or your app's JobScheduler schedules a network task or your app manages to piggyback on some other app's network connection(this happens often but I am still trying to figure out how to implement this in code).
Caveat:- Offline messages have limits if you have a large number of clients connecting with MQTT server then you will need adequate storage space. When the device enters doze, then there is 15-20min gap between the time when the message is published and when the message is received by android service. Once the device opens up this returns to real-time depending on your message size and internet connectivity.
I tested this with VerneMQ written in Erlang. You will need a unique client ID for each connecting client.
@chintan-mishra : i have setup vernemq broker on mac and have an android app which is acting as client and i am trying to connect the client by passing ip address of the mac system to the broker. But getting exception failed to connect.
Even i tried passing the system name but it is giving error unKnownhost.
both android device and mac system are using the same wi-fi n/w.
Not able to figure-out the solution. can you please help me?
@jitendrakm41 you have asked this in #327
In the future, please avoid fragmenting conversations.
@vivekebics please close this issue
@chintan-mishra yes, you can close this issue. i will make sure this doesn't happen from next time.
Thanks
I am using mosquitto server for message transfer. I have configured in window machine. I have written android service to connect the broker. I am facing connection Failed. The connection is keep on connecting and disconnecting. I am not getting stable connection to subscribe topic. which puts me in trouble to lose messages. can you please advice me ? I am in very difficult situation where i have main for than 1000 subscription. Eagerly looking forward to your feedback.