sockets/socket_manager library

Classes

ConnectLocalSocketOptions
Options for connecting to a local socket. Supports optional authentication parameters for backend handshake.
ConnectSocketOptions
Options for connecting to a socket.
DisconnectSocketOptions
ResponseLocalConnection
Response for local socket connection.
ResponseLocalConnectionData
Data received during local socket connection.

Enums

MediaSocketConnectPhase
Where a media socket connection attempt stopped.

Constants

mediaConnectionRejectionReasons → const List<String>
Reasons a media node sends with connection-rejected { reason, stage } (media admission v2) just before it closes a refused handshake.

Functions

clearRefusedMediaCredentials() → void
Forgets every remembered media-server refusal (for example after the user changed rooms or credentials).
connectLocalSocket(ConnectLocalSocketOptions options) → Future<ResponseLocalConnection>
Connects to a media socket with the specified options. Returns a ResponseLocalConnection containing the socket and connection data. Throws an exception if inputs are invalid or if connection fails. Example usage:
connectSocket(ConnectSocketOptions options) → Future<Socket>
currentOnlineState() → bool?
navigator.onLine on web; null elsewhere (unknown).
describeMediaSocketError(Object? error, {String fallback = 'Unable to connect. Check your credentials and try again.'}) → String
User-facing text for any connection error; fallback for errors that are not MediaSocketConnectException.
disconnectSocket(DisconnectSocketOptions options) → Future<bool>
Disconnects the given socket instance. Returns true upon successful disconnection.
isRetryableMediaSocketError(Object? error) → bool
False only for rejections that cannot succeed on retry with the same credentials.
normalizeRejectionReason(Object? reason) → String
Maps any reason from the server onto a known one (unknown values become rejected-before-connection-success).
validateApiKeyToken(String value) → Future<bool>
Validates the provided API key or token. Returns true if the API key or token is valid, otherwise throws an exception.

Exceptions / Errors

MediaSocketConnectException
Thrown by connectSocket when the media socket cannot be used.