Webcom C SDK
webcom-libevent.h File Reference
#include "webcom-config.h"
#include "webcom-eli.h"
#include <event.h>
Include dependency graph for webcom-libevent.h:

Go to the source code of this file.

Functions

wc_context_twc_context_new_with_libevent (char *host, uint16_t port, char *application, struct event_base *loop, struct wc_eli_callbacks *callbacks)
 

Function Documentation

◆ wc_context_new_with_libevent()

wc_context_t* wc_context_new_with_libevent ( char *  host,
uint16_t  port,
char *  application,
struct event_base *  loop,
struct wc_eli_callbacks callbacks 
)

Create a webcom context using libevent.

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 libevent.

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
hostthe webcom server host name
portthe webcom server port
applicationthe name of the webcom application to tie to (e.g. "legorange", "chat", ...)
loopa pointer to a libevent 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