Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

swim360's avatar

Update rider's lat longs via api as he moves

I need to constantly update rider's location as he keeps moving through api. I am creating api in Laravel and these apis will be used through mobile app.

If i had frontend i'd have listened to pusher event on front end and keep updating the location but now i dont have front end so i am unable to listen pusher events.

There is another way that mobile app sends me requests and i keep updating his location but i dont want to send requests each second.

Question is If mobile app broadcast a pusher event as rider moves, i listen to that event in my laravel controller and update the lat longs. Or suggest me any other work around that i should go with. Assistance from seniors is much appreciated

0 likes
7 replies
swim360's avatar

@Snapey it is not helpful. can you suggest me something else to do this task!

Snapey's avatar

i dont want to send requests each second.

So send them at an interval that you are comfortable with. You need to decide what is the correct level of granularity for your application. For instance, you could send the coordinates at fixed time intervals, or when the 'rider' has travelled a certain distance.

It just depends on the use case.

1 like
martinbean's avatar

@swim360 You don’t want to be issuing API requests like that. It means the rider app will be continually establishing a HTTPS connection, sending a request, closing the connection; opening a new HTTPS connection, sending a request, closing the connection…

A better way would instead be a web socket. You open the socket connection with a server, and then the rider app can periodically emit an event on the socket with their current location.

Please or to participate in this conversation.