Socket
class Socket(url: String, paramsClosure: PayloadClosure, gson: Gson, client: OkHttpClient)
Content copied to clipboard
A Socket which connects to a Phoenix Server. Takes a closure to allow for changing parameters to be sent to the server when connecting.
Example
val socket = Socket("https://example.com/socket", { mapOf("token" to mAuthToken) })Parameters
url
Url to connect to such as https://example.com/socket
paramsClosure
Closure which allows to change parameters sent during connection.
gson
Default GSON Client to parse JSON. You can provide your own if needed.
client
Default OkHttpClient to connect with. You can provide your own if needed.
Constructors
Socket
Link copied to clipboard
fun Socket(url: String, paramsClosure: PayloadClosure, gson: Gson = Defaults.gson, client: OkHttpClient = OkHttpClient.Builder().build())
Content copied to clipboard
Url to connect to such as https://example.
Functions
disconnect
Link copied to clipboard
fun disconnect(code: Int = WS_CLOSE_NORMAL, reason: String? = null, callback: () -> Unit? = null)
Content copied to clipboard
removeAllCallbacks
Link copied to clipboard
fun removeAllCallbacks()
Content copied to clipboard
Properties
endpointUrl
Link copied to clipboard
heartbeatIntervalMs
Link copied to clipboard
isConnected
Link copied to clipboard
paramsClosure
Link copied to clipboard
reconnectAfterMs
Link copied to clipboard
rejoinAfterMs
Link copied to clipboard
skipHeartbeat
Link copied to clipboard