Web Sockets package object

This package implements the Websocket protocol as described in the RFC 6455. It allow to define callbacks on specifics events and also implements a broadcaster service to make easier distribute message among different active connections.

Initialization

In order to make use of websocket package, two simple steps are required: the first one is to include the package header file on top of your code, then perform an explicit package inside duda_main() function.

Example:

/* Include package header */
#include "packages/websocket/websocket.h"

int duda_main()
{
    ...
    duda_load_package(websocket, "websocket");
    ...
    /*
     * In case you want to use the websocket broadcast feature you must enable the
     * broadcaster service:
     */
    websocket->broadcaster();

    ...
    return 0;
}

Once the package is loaded, you can use any methods from your callbacks in the following way:

websocket->method(...)

Methods