Webcom C SDK
Webcom C SDK Documentation Page

This is the documentation for the Webcom C SDK, a SDK that allows connecting to, and interacting with the Webcom platform.

What is Webcom?

Webcom is a Backend As A Service platform offering

Orange operates a Webcom-based service named Orange Flexible Datasync. Create an account on https://io.datasync.orange.com/u/signup to start using webcom.

Get the C SDK

The SDK is published on GitHub: https://github.com/webcom-components/webcom-sdk-c

You'll find informations on the supported platforms, building or getting binary versions in the README.md document.

Use the SDK

Browse the modules page to get informations on the API.

Show me the code!

OK.

int main(int argc, char *argv[]) {
// get a libev event loop
struct ev_loop *loop = EV_DEFAULT;
// set a bunch of general-purpose datasync callbacks
struct wc_eli_callbacks cb = {
.on_disconnected = on_disconnected,
.on_error = on_error,
};
// set the connection options
struct wc_context_options options = {
.host = "io.datasync.orange.com",
.port = 443,
.app_name = "my_namespace",
};
// establish the connection to the webcom server, and let it integrate in
// our libev event loop
&options,
loop,
&cb);
// we are going to use the datasync service
// ask the SDK to establish the connection to the server
// enter the event loop
ev_run(loop, 0);
// destroy the context when the loop ends
return 0;
}
// called when the connection to the server is established
static void on_connected(wc_context_t *ctx) {
wc_datasync_on_child_added(ctx, "/foo/bar", on_foo_bar_added);
}
// called whenever a new child node is appended to /foo/bar
int on_foo_bar_added(wc_context_t *ctx, on_handle_t handle, char *data, char *cur, char *prev) {
printf("a new child named [%s] with value [%s] was added on path /foo/bar\n", cur, data);
return 1;
}
(...)