connect

abstract suspend fun connect(url: String, headers: Map<String, String> = emptyMap()): WebSocketConnection(source)

Opens a web socket connection and suspends until the connection is OPEN.

Parameters

headers

custom headers to send during the web socket handshake. Support for custom handshake headers is optional. Implementations that don't support them must throw an IllegalArgumentException if headers is not empty.

Throws

if an error occurs during the connection.