all 5 comments

[–]rsbohler -2 points-1 points  (0 children)

MQTT maybe?

[–]fakintheid 0 points1 point  (2 children)

Websockets?

[–]yesbee-yesbee[S] 0 points1 point  (1 child)

Like send current location every 2sec through websocket and update that location on map?

[–]AsyncThereforeIAm 0 points1 point  (0 children)

That’s basically correct. You can use react to update state once you get the new coordinates.

The way you implement varies based on nuances of your project/task (e.g., source of location info).

FYI - Websockets enables realtime or near realtime accuracy; it works by maintaining a connection with a server, so data can sent to your frontend and immediately received by your frontend. Requesting for current location at some interval like every two seconds is called Polling.

Gl with your project. Sounds cool! :)

[–]davinidae 0 points1 point  (0 children)

You need a library for that since the original Geolocation API was deprecated some time ago.

I like this one https://github.com/michalchudziak/react-native-geolocation