phoenix-channels-essentials

Enforce authentication, authorization, and presence patterns in Phoenix Channels for non-LiveView clients.

149|15|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-channels-essentials
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phoenix-channels-essentials
Source: https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/phoenix-channels-essentials
Command: npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-channels-essentials

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Real-time Phoenix Channels require secure, scalable patterns to connect non-LiveView clients without burdening the Plug pipeline. This skill codifies authentication, authorization, presence, and clean channel design to ensure consistent, maintainable real-time features.

Core Features & Use Cases

  • Authenticated connections: enforce authentication in connect/3 to validate sockets.
  • Authorized joins: verify access in join/3 before subscribing clients to a topic.
  • Message patterns: use handle_in, push, and broadcast to route client-server interactions clearly.
  • Thin channels: delegate business logic to context modules to keep channels focused on transport.
  • Presence and discovery: leverage Phoenix.Presence to track and expose online users.
  • Testing & reliability: provide test patterns and examples to validate real-time flows.

Quick Start

Apply these patterns to your Phoenix project to establish secure, maintainable real-time channels quickly.

Frequently Asked Questions about phoenix-channels-essentials

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I authenticate Phoenix Channels for non-LiveView clients?

Authenticate Phoenix Channels by enforcing authentication inside the connect/3 function to validate sockets before establishing real-time connections for non-LiveView clients.

What is the best way to authorize topic joins in Phoenix Channels?

Authorize topic joins by verifying client access permissions inside the join/3 function before allowing subscription to specific channel topics.

How do I keep Phoenix Channels thin and maintainable?

Keep Phoenix Channels thin by delegating business logic to context modules, ensuring channels remain focused on transport layers and client-to-server messaging routing.

How does Phoenix Presence track online users in real-time channels?

Phoenix Presence leverages Phoenix.Presence to track and expose online users, providing discovery and presence tracking across connected real-time clients.

Can I use these channel patterns for notification and room channels?

Yes, apply these context-driven channel patterns across both room and notification channels to enforce secure, authenticated real-time communication.

What are the limitations of using channels instead of LiveView for real-time features?

Phoenix Channels require manual implementation of socket authentication, topic authorization, and push semantics, making them necessary for non-LiveView clients but more complex than LiveView.