Session.websocketConnectAsync

Asynchronously creates a #SoupWebsocketConnection 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_websocket_connect_finish() will return a new #SoupWebsocketConnection. 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_websocket_connect_finish() will return %SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET.

class Session
void
websocketConnectAsync
(,
string origin
,
string[] protocols
,
Cancellable cancellable
,
GAsyncReadyCallback callback
,
void* userData
)

Parameters

msg Message

#SoupMessage indicating the WebSocket server to connect to

origin string

origin of the connection

protocols string[]

a %NULL-terminated array of protocols supported

cancellable Cancellable

a #GCancellable

callback GAsyncReadyCallback

the callback to invoke

userData void*

data for @callback

Meta

Since

2.50