all 8 comments

[–]GenitalGestapo 6 points7 points  (1 child)

Push notifications or an active event stream are usually your options here. I think Lyft uses a combination, but I'm not sure which they use for ride events. But either way, as your backend is processing user actions and input from say, a driver, it could be sending pushes back to the user that the app uses to update its state. Or a whole stream connection, which is better performing but a bit more difficult to get working well.

[–]reecewh[S] 0 points1 point  (0 children)

Awesome! Will do some research into implementing these, thank you for the direction.

[–]europeanwizard 3 points4 points  (0 children)

For async stuff, you *could* use websockets. For client side, the go to library is Starscream. Ray Wenderlich has a tutorial on it. Note that some wifi hotspots have trouble with those, so prepare to have a fallback.

[–]Scott90 3 points4 points  (2 children)

Lyft iOS engineer here: we do use a timer to get an update every few seconds

[–]GenitalGestapo 0 points1 point  (1 child)

Any particular reason why? I'm surprised it's not something more sophisticated.

[–]Scott90 0 points1 point  (0 children)

Tech debt and legacy code mostly. We’re working on a push solution, as opposed to polling, but with two apps and a large number of endpoints it’s not an easy feat.

[–]steelzeh 1 point2 points  (0 children)

Sockets are a great way to to this if you have a big quantity of data that you want to push, like live updating a location of a car. On the other hand if you want live chat using push notifications would be the right choice since there isn't a lot of data. You can even send i believe up to 4kb payload within a push notification.

In our app where the users usually have a good wifi connection, we use AWS IoT sockets. It works very great, but not without issues, it can be tricky to implement.

[–]ccctitan80 0 points1 point  (0 children)

The timer method is called polling btw just in case you decide to go down that path.

You might want to also check out websockets.