Search code examples
javaandroidrestreal-time-data

Is there a way to trigger a specific code block when a REST API updates its values


I'm curious if it's possible to trigger a specific piece of code when a REST API its values changes. Actually a sort of realtime update a mechanism.

If it's not possible, what's a better to do it? The idea is when I push on a button (on my android device) a text will appear in a game (Java Desktop).

Thank you!


Solution

  • Your question is not clear please rephrase it.

    As you said you want that has to be done realtime.

    Possible three approaches:

    In android there are connection APIs with which you can connect your desktop(must have WiFi enabled) with phone. Then you can send or receive files and messages directly.

    The other way is to have Push notifications but it's not guarantees realtime fast some time gets delayed otherwise performs good always.

    Other way is to keep the connected socket open for listening changes from phone side to desktop side once connected but it's more costly.

    Hope this gives you a direction, rest you can search over internet.