📎 Webclip
Building a Ride Sharing App with Elixir and Phoenix Channels — Part 2
The second part of the tutorial shifts from the authentication endpoint to the main feature of the ride-sharing backend: real-time matching between drivers and riders. It explains how Phoenix Channels handles messages over HTTP, usually through a websocket connection, with the Phoenix app acting as the orchestrator for incoming and outgoing traffic.
Reading notes#
- The post is the second part of a tutorial about a small ride-sharing backend built with Elixir and Phoenix.
- The previous part covered the project bootstrap and the authentication endpoint.
- This part focuses on real-time matching between drivers and riders.
- Phoenix Channels sends real-time messages between senders and receivers over HTTP.
- It is usually used through websockets, but it also supports long polling.
- Clients connect to a socket, similar to a native websocket server.
- Connected clients can publish and receive messages from other clients.
- The server, here the Phoenix application, acts as the orchestrator for incoming and outgoing messages.
- Phoenix uses topics to route messages to the correct channel.
- After connecting to a socket, a client can join one or more topics.
- The same client can then publish messages to those topics.
