phoenix_socket library Null safety

Dart library to interact with Phoenix Channels and Presence over WebSockets.

This library uses web_socket_channel for WebSockets, making the API consistent across web and native environments.

Like other implementation of clients for Phoenix Sockets, this library provides a PhoenixSocket class that can be used to manage connections with remote Phoenix servers. PhoenixChannels can be joined through that PhoenixSocket class, through which Messages can be sent and received. To send a message on a channel, possibly expecting a reply, the Push class can be used.

Classes

Message
Class that encapsulate a message being sent or received on a PhoenixSocket.
PhoenixChannel
Bi-directional and isolated communication channel shared between differents clients through a common Phoenix server.
PhoenixChannelEvent
Encapsulates constants used in the protocol over PhoenixChannel.
PhoenixPresence
PhoenixSocket
Main class to use when wishing to establish a persistent connection with a Phoenix backend using WebSockets.
PhoenixSocketCloseEvent
Close event for a PhoenixSocket.
PhoenixSocketErrorEvent
Error event for a PhoenixSocket.
PhoenixSocketEvent
Base socket event
PhoenixSocketOpenEvent
Open event for a PhoenixSocket.
PhoenixSocketOptions
Options for the open Phoenix socket. [...]
Push
Object produced by PhoenixChannel.push to encapsulate the message sent and its lifecycle.
PushResponse
Encapsulates the response to a Push.

Constants

statesIgnoringErrors → const Set<PhoenixChannelState>
A set of States where an error triggered by the parent socket do not end up triggering an error on the channel.
const {PhoenixChannelState.errored, PhoenixChannelState.leaving, PhoenixChannelState.closed}

Functions

noopWithNoArg() → void
noopWithThreeArgs(String a, dynamic b, dynamic c) → void

Enums

PhoenixChannelState
The different states a channel can be.
SocketState
State of a PhoenixSocket.

Typedefs

JoinHandler(String key, dynamic current, dynamic joined) → void
LeaveHandler(String key, dynamic current, dynamic left) → void
PayloadGetter() Map<String, dynamic>
Type of function that should return a push payload

Exceptions / Errors

ChannelTimeoutException
Exception thrown when a Push's reply was awaited for, and the allowed delay has passed.
PhoenixException
Exception yield when a PhoenixSocket closes for unexpected reasons.