Reputation: 515
I want a mobile application that will create/update/delete contacts from the phone when a main server (on a remote VM) will ask for it.
The current process: The mobile application sends a GET REQUEST
(every X seconds) and asking the server if she needs to do something. If the server needs to create/update/delete contacts from the phone, it will include it in the GET RESPONSE
.
I would like to save this useless calls from the mobile application and find a way to send some REQUEST / TASK to the app when the server actually want to do it.
I thought about building a backend server for my mobile app, but again, the app will need to ask the server about the changes.
It will be great to hear your thoughts here! Can a mobile application acts like a server? Firebase will help here?
Upvotes: 0
Views: 53
Reputation: 9446
The biggest problem here is going to be routing. Phones by their very nature have a roaming address that changes on a regular basis as you move through the network. To route a request to the phone, the server would have to be aware of the phone's IP address at all times, additionally NAT introduces additional inbound complexity here.
Most solutions will end up being some kind of client-driven polling-based (including Firebase FCM), which is ultimately just a re-implementation of what you already have (periodic polling to check for changes).
Upvotes: 1
Reputation: 687
Yes, firebase can help here to 'push' the update/create/delete contact command from your main server into device. The high level design could look something like picture.
Upvotes: 1