VortexConnection * vortex_websocket_connection_new ( const char *  host,
const char *  port,
VortexWebsocketSetup setup,
VortexConnectionNew  on_connected,
axlPointer  user_data 
)

Creates a new BEEP connection to a remote BEEP server, by connecting to a WEBSOCKET server supporting WEBSOCKET CONNECT method (proxy server).

Parameters
hostThe remote peer to connect to. This value will be used for the Host WEBSOCKET header. In the case you want to use a different Host header value than the value provided here use the configuration item VORTEX_WEBSOCKET_CONF_ITEM_HOST (VortexWebsocketConfItem and vortex_websocket_setup_conf).
portThe peer's port to connect to. This value will be used for the port part of the Host header.
setupAdditional connection options. It must configure at least the origin value (VORTEX_WEBSOCKET_CONF_ITEM_ORIGIN). Th reference you pass to this function will be owned by the connection created. This means you don't have to release the setup object created. If you want to reuse the same setup object, increase the reference counting each time you call this function (vortex_websocket_setup_new).
on_connectedOptional handler to process connection new status.
user_dataOptional handler to process connection new status
Returns
A newly created VortexConnection if called in a blocking manner, that is, without providing the on_connected handler. If you provide the on_connected handler, the function will return NULL, and the connection created will be notified on the handler on_connected. In both cases, you must use vortex_connection_is_ok to check if you are already connected.

NOTE: The VortexCtx object to be used on this function will be the one configured on setup parameter (reference provided at vortex_websocket_setup_new). This means you'll have to create different VortexWebsocketSetup instances for each context you have.

References vortex_thread_pool_new_task().