How PhoenixSocket, PhoenixChannel, and PhoenixPresence work together
masterThe library follows the design patterns of the official Phoenix JavaScript client, using Godot's WebSocketClient for transport. The hierarchy of connection is as follows:
PhoenixSocket: The entry point. It manages the connection to the Phoenix server (e.g.,ws://localhost:4000/socket), handles heartbeats, reconnection timers, and socket-level events.PhoenixChannel: Created via aPhoenixSocket. It represents a specific topic (e.g.,game:abc) and handles joining, leaving, pushing messages, and receiving events.PhoenixPresence: An optional component passed to aPhoenixChannelto enable tracking of connected clients (Presence) within that channel.
When a Node is freed, the library automatically handles disconnection and channel leaving.