Skip to main content
100%

phoenix_channels

✓ Published0🌍 Public
Aallyraza
Last edited Jan 7, 2016
Created on Jan 7, 2016

This example demonstrates real-time chat activity in a Phoenix Channels application. It shows how a server broadcasts user join events to connected clients, while the client-side channel listener appends incoming messages to a growing list. The Elixir server code uses `send(self, :after_join)` to trigger a `handle_info` callback that calls `broadcast!` and `push`, while the JavaScript client uses the channel’s `on("user:joined", ...)` method to update component state. The data flow is visible from the `%{text: "new user joined!"}` payload being concatenated into the `messages` array on each event.

AI-generated description

Similar vizzes