Phoenix.SocketClient.ChannelManager (phoenix_socket_client v0.7.0)
Dynamic supervisor for managing channel processes.
This module supervises individual channel processes, handling their lifecycle from creation to termination. It provides functionality for:
- Starting and supervising channel processes
- Finding channel processes by topic
- Managing channel lifecycle events
Channel Lifecycle
Channels are started as child processes under this supervisor when:
- A client calls
Phoenix.SocketClient.Channel.join/3 - The socket connection is active and the channel join is successful
Channels are terminated when:
- The channel is left explicitly via
Channel.leave/1 - The socket connection is lost
- The supervisor terminates
Summary
Functions
Finds the PID of a channel process by its topic.
Returns a specification to start this module under a supervisor.
Starts a channel process.
Starts the ChannelManager dynamic supervisor.
Terminates all channel processes.
Functions
Finds the PID of a channel process by its topic.
Parameters
sup_pid- The supervisor PIDtopic- The channel topic to search for
Returns
pid- The channel PID if foundnil- If no channel with the given topic exists
Examples
channel_pid = Phoenix.SocketClient.ChannelManager.channel_pid(sup_pid, "rooms:lobby")
Returns a specification to start this module under a supervisor.
See Supervisor.
Starts a channel process.
Starts the ChannelManager dynamic supervisor.
Parameters
opts- Configuration options (unused, required by DynamicSupervisor)
Examples
{:ok, pid} = Phoenix.SocketClient.ChannelManager.start_link([])
@spec terminate(pid()) :: :ok
Terminates all channel processes.