SocketCommon

abstract class SocketCommon(params: PayloadClosure, vsn: String, encode: EncodeClosure, decode: DecodeClosure, scope: CoroutineScope)

Functions

Link copied to clipboard
fun channel(topic: String, socket: SocketFlow, params: Payload = emptyMap()): Channel

Creates an instance of Channel bound to the specified topic and Socket, taking optional parameters.

Link copied to clipboard
suspend fun connect(): SocketFlow?

Connects to the Phoenix Socket. Suspends until the server acknowledges the connection.

Link copied to clipboard
fun disconnect(code: Int = WS_CLOSE_NORMAL, reason: String? = null)

Disconnects from the Phoenix Socket and resets the reconnectTimer.

Link copied to clipboard
fun remove(channel: Channel)

Properties

Link copied to clipboard
abstract var endpoint: String

The string WebSocket endpoint (ie "ws://example.com/socket", "wss://example.com", etc.) that was passed to the Socket during initialization. The URL endpoint will be modified by the Socket to include "/websocket" if missing.

Link copied to clipboard
abstract var endpointUrl: URL

The fully qualified socket URL

Link copied to clipboard
val isConnected: Boolean
Link copied to clipboard
var logger: (String) -> Unit? = null

The optional function to receive logs

Link copied to clipboard
abstract val protocol: String
Link copied to clipboard
var reconnectAfterMs: (Int) -> Long

Interval between Socket reconnect attempts, in ms

Link copied to clipboard
var rejoinAfterMs: (Int) -> Long

Interval between Channel rejoin attempts, in ms

Link copied to clipboard
var timeout: Long

Timeout to use when opening a connection

Inheritors

Link copied to clipboard