↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

Building a Ride Sharing App with Elixir and Phoenix Channels — Part 3

This part of the tutorial adds Phoenix Presence to the ride-sharing app so it can display nearby drivers on the map. The idea is to track drivers who join a channel for a given location and keep a fresh view of their current state and position.

Reading notes
#

  • The first two parts already established ride requests and driver acceptance using Phoenix Channels.
  • This part introduces Presence as another Channels feature.
  • The official documentation describes Phoenix Presence as a way to register process information on a topic and replicate it across a cluster.
  • Presence combines a server-side and client-side library.
  • A simple use case for Presence is showing which users are currently online.
  • The app applies that same idea to drivers.
  • Drivers join a channel for a given location using geohash topics.
  • Presence is used to track those drivers in the app.
  • The result is an up-to-date view of driver state and current location for the map.