connect
Opens a web socket connection to the given url and suspends until the connection is OPEN.
Parameters
the URL to connect to
an optional list of one or more web socket subprotocols that is intended to be spoken over the created web socket connection. The list should be provided in order of preference. The first one that is supported by the server will be selected during the handshake, and can be found at WebSocketConnection.protocol.
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 the headers map is not empty but the client doesn't support custom headers
if an error occurs during the connection.