PhoenixSocket class

Main class to use when wishing to establish a persistent connection with a Phoenix backend using WebSockets.

Implementers

Constructors

PhoenixSocket(String endpoint, {PhoenixSocketOptions? socketOptions, WebSocketChannel webSocketChannelFactory(Uri uri)?})
Creates an instance of PhoenixSocket

Properties

channels Map<String, PhoenixChannel>
Map of topic names to PhoenixChannel instances being maintained and tracked by the socket.
getter/setter pair
closeStream Stream<PhoenixSocketCloseEvent>
Stream of PhoenixSocketCloseEvent being produced whenever the connection closes.
no setter
defaultTimeout Duration
Default duration for a connection timeout.
no setter
endpoint String
The string URL of the remote Phoenix server.
no setter
errorStream Stream<PhoenixSocketErrorEvent>
Stream of PhoenixSocketErrorEvent being produced in the lifetime of the PhoenixSocket.
no setter
hashCode int
The hash code for this object.
no setterinherited
isConnected bool
Whether the underlying socket is connected of not.
no setter
messageStream Stream<Message>
Stream of all Message instances received.
no setter
mountPoint Uri
The Uri containing all the parameters and options for the remote connection to occue.
no setter
nextRef String
A property yielding unique message reference ids, monotonically increasing.
no setter
openStream Stream<PhoenixSocketOpenEvent>
Stream of PhoenixSocketOpenEvent being produced whenever the connection is open.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addChannel({required String topic, Map<String, dynamic>? parameters, Duration? timeout}) PhoenixChannel
topic is the name of the channel you wish to join parameters are any options parameters you wish to send
close([int? code, String? reason, dynamic reconnect = false]) → void
Close the underlying connection supporting the socket.
connect() Future<PhoenixSocket?>
Attempts to make a WebSocket connection to the Phoenix backend.
dispose() → void
Dispose of the socket.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onSocketDataCallback(dynamic message) → dynamic
Processing incoming data from the socket
removeChannel(PhoenixChannel channel) → void
Stop managing and tracking a channel on this phoenix socket.
sendMessage(Message message) Future<Message>
Send a channel on the socket.
streamForTopic(String topic) Stream<Message>
A stream yielding Message instances for a given topic.
toString() String
A string representation of this object.
inherited
waitForMessage(Message message) Future<Message>
Wait for an expected message to arrive.

Operators

operator ==(Object other) bool
The equality operator.
inherited