Webcom C SDK
Data Structures
Create a base context with libev (the easy way)

Data Structures

struct  wc_eli_callbacks
 
wc_context_twc_context_create_with_libev (struct wc_context_options *options, struct ev_loop *loop, struct wc_eli_callbacks *callbacks)
 

Detailed Description

Function Documentation

◆ wc_context_create_with_libev()

wc_context_t* wc_context_create_with_libev ( struct wc_context_options options,
struct ev_loop *  loop,
struct wc_eli_callbacks callbacks 
)

This SDK is designed using an asynchronous, event-based approach, and is perfectly suited to be used in a mono-threaded application.

To greatly relieve the burden of registering to, and handling all the I/O and timer events the SDK must be aware of, and if you don't mind making your application rely on libev, we've already taken care of everything.

The key idea is to call the corresponding wc_context_new_with_libev() function, and pass :

  • the reference to your event loop
  • a couple of callbacks to be notified when the connection is established/closed Create a webcom context using libev.

This function creates a new Webcom context, an initiates the connection towards the server. All the underlying I/O and timer events will be taken care of by libev.

If the http_proxy environment variable is set, the connection will be established through this HTTP proxy.

Note
this function is partly synchronous and returns once the DNS lookup and TCP handshake have succeeded or failed.
Parameters
optionsa pointer to a structure bearing the connection informations
loopa pointer to a libev loop object
callbacksa structure containing the callbacks to trigger for various events
Returns
a pointer to the newly created connection on success, NULL on failure to create the context