Socket
fun Socket(url: String, params: Payload? = null, encode: EncodeClosure = Defaults.encode, decode: DecodeClosure = Defaults.decode, client: OkHttpClient = OkHttpClient.Builder().build())
Content copied to clipboard
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
encode
Optional. Provide a custom JSON encoding implementation
decode
Optional. Provide a custom JSON decoding implementation
client
Default OkHttpClient to connect with. You can provide your own if needed.
fun Socket(url: String, paramsClosure: PayloadClosure, encode: EncodeClosure = Defaults.encode, decode: DecodeClosure = Defaults.decode, client: OkHttpClient = OkHttpClient.Builder().build())
Content copied to clipboard
Parameters
url
Url to connect to such as https://example.com/socket
paramsClosure
Closure which allows to change parameters sent during connection.
encode
Optional. Provide a custom JSON encoding implementation
decode
Optional. Provide a custom JSON decoding implementation
client
Default OkHttpClient to connect with. You can provide your own if needed.