Socket

open class Socket(baseUrl: String = "", protocols: Array<out String> = emptyArray())

Socket defines how to connect via websocket. Therefore, it needs an baseUrl and an optional list of protocols. The Session will be established after calling the connect method.

Constructors

Link copied to clipboard
constructor(baseUrl: String = "", protocols: Array<out String> = emptyArray())

Functions

Link copied to clipboard
fun append(subUrl: String): Socket

Appends the given subUrl to the baseUrl and returns a new instance of Socket.

Link copied to clipboard
fun connect(subUrl: String = ""): Session

Creates a Session by trying to connect to the websocket endpoint. When connection was successfully made, you can send and receive message via websockets.

Link copied to clipboard
fun protocols(vararg protocols: String): Socket

sets or overrides the given list of protocols for the Socket and returns a new instance of Socket.