Session.websocketConnectAsync

void websocketConnectAsync(soup.message.Message msg, string origin, string[] protocols, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)

Asynchronously creates a classWebsocketConnection to communicate with a remote server.

All necessary WebSocket-related headers will be added to msg, and it will then be sent and asynchronously processed normally (including handling of redirection and HTTP authentication).

If the server returns "101 Switching Protocols", then msg's status code and response headers will be updated, and then the WebSocket handshake will be completed. On success, [soup.session.Session.websocketConnectFinish] will return a new classWebsocketConnection. On failure it will return a #GError.

If the server returns a status other than "101 Switching Protocols", then msg will contain the complete response headers and body from the server's response, and [soup.session.Session.websocketConnectFinish] will return [soup.types.WebsocketError.NotWebsocket].

Parameters

msg#SoupMessage indicating the WebSocket server to connect to
originorigin of the connection
protocolsa null-terminated array of protocols supported
ioPrioritythe I/O priority of the request
cancellablea #GCancellable
callbackthe callback to invoke