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

Types

ReadyState
Link copied to clipboard
enum ReadyState : Enum<Transport.ReadyState>
Available ReadyStates of a {@link Transport}.

Functions

connect
Link copied to clipboard
abstract fun connect()
Connect to the server
disconnect
Link copied to clipboard
abstract fun disconnect(code: Int, reason: String? = null)
Disconnect from the Server
send
Link copied to clipboard
abstract fun send(data: String)
Sends text to the Server

Properties

onClose
Link copied to clipboard
abstract var onClose: (Int) -> Unit?
Called when the Transport closes
onError
Link copied to clipboard
abstract var onError: (Throwable, Response?) -> Unit?
Called when the Transport receives an error
onMessage
Link copied to clipboard
abstract var onMessage: (String) -> Unit?
Called each time the Transport receives a message
onOpen
Link copied to clipboard
abstract var onOpen: () -> Unit?
Called when the Transport opens
readyState
Link copied to clipboard
abstract val readyState: Transport.ReadyState
The state of the Transport.

Inheritors

WebSocketTransport
Link copied to clipboard