newWebSocket

open override fun newWebSocket(url: String, protocols: List<String>, headers: Map<String, String>): WebSocket(source)

Creates a WebSocket connection to the given url, using the provided headers in the handshake.

This function may throw an exception if headers is not empty and the underlying implementation doesn't support custom headers in the handshake.