Socket

fun Socket(url: String, params: Payload? = null, gson: Gson = Defaults.gson, client: OkHttpClient = OkHttpClient.Builder().build())

A Socket which connects to a Phoenix Server. Takes a constant parameter to be sent to the server when connecting. Defaults to null if excluded.

Example

val socket = Socket("https://example.com/socket", mapOf("token" to mAuthToken))

Parameters

url

Url to connect to such as https://example.com/socket

params

Constant parameters to send when connecting. Defaults to null

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.

fun Socket(url: String, paramsClosure: PayloadClosure, gson: Gson = Defaults.gson, client: OkHttpClient = OkHttpClient.Builder().build())

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.