Webcom C SDK
General Webcom SDK functions
int64_t wc_datasync_server_time (wc_context_t *cnx)
 
void wc_datasync_gen_push_id (wc_context_t *cnx, char *result)
 
const char * wc_version ()
 

Detailed Description

Function Documentation

◆ wc_datasync_gen_push_id()

void wc_datasync_gen_push_id ( wc_context_t cnx,
char *  result 
)

builds a webcom push id

This function will write a new push id in the buffer pointed by result.

A push id is a 20-bytes string that guarantees several properties:

  • all SDKs across all platform generate it using the exact same method
  • when sorted in lexicographical order, they are also sorted by chronological order of their creation, regardless of what webcom client node has generated it (the SDKs does so by computing a local to server clock offset during the webcom protocolar handshake)

Example:

    foo(wc_cnx_t *cnx) {
        char buf[20];
        ...
        wc_get_push_id(cnx, buf);
        printf("the id is: %20s\n", buf);
        ...
    }
Note
the result buffer will not be nul-terminated
Parameters
cnxthe webcom connection (it MUST have received the handshake from the server, and it may be currently connected or disconnected)
resultthe address of a (minimum) 20-bytes buffer that will receive the newly created push id

◆ wc_datasync_server_time()

int64_t wc_datasync_server_time ( wc_context_t cnx)

gets the server time in milliseconds since 1970/1/1

This function returns the (estimated) time on the server, in milliseconds. It is achieved by the SDK by computing and memorizing the clock offset between the local machine and the server when establishing the connection to the Webcom server.

Parameters
cnxthe webcom connection
Returns
the estimated server time in milliseconds since 1970/1/1

◆ wc_version()

const char* wc_version ( )

get the webcom SDK version string

Returns
a string representing the version