Transport

interface Transport

Interface that defines different types of Transport layers. A default {@link WebSocketTransport} is provided which uses an OkHttp WebSocket to transport data between your Phoenix server.

Future support may be added to provide your own custom Transport, such as a LongPoll

Inheritors

Types

Link copied to clipboard

Available ReadyStates of a {@link Transport}.

Properties

Link copied to clipboard
abstract var onClose: (Int) -> Unit?

Called when the Transport closes

Link copied to clipboard
abstract var onError: (Throwable, Response?) -> Unit?

Called when the Transport receives an error

Link copied to clipboard
abstract var onMessage: (String) -> Unit?

Called each time the Transport receives a message

Link copied to clipboard
abstract var onOpen: () -> Unit?

Called when the Transport opens

Link copied to clipboard

The state of the Transport. See {@link ReadyState}

Functions

Link copied to clipboard
abstract fun connect()

Connect to the server

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

Disconnect from the Server

Link copied to clipboard
abstract fun send(data: String)

Sends text to the Server