Webcom C SDK
Send requests: send data, subscribe to data change, ...
typedef void(* wc_on_req_result_t) (wc_context_t *cnx, int64_t id, wc_action_type_t type, wc_req_pending_result_t status, char *reason, char *data, void *user)
 
int64_t wc_datasync_put (wc_context_t *cnx, char *path, char *json, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_merge (wc_context_t *cnx, char *path, char *json, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_push (wc_context_t *cnx, char *path, char *json, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_listen (wc_context_t *cnx, char *path, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_unlisten (wc_context_t *cnx, char *path, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_auth (wc_context_t *cnx, char *cred, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_unauth (wc_context_t *cnx, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_on_disc_put (wc_context_t *cnx, char *path, char *json, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_on_disc_merge (wc_context_t *cnx, char *path, char *json, wc_on_req_result_t callback, void *user)
 
int64_t wc_datasync_on_disc_cancel (wc_context_t *cnx, char *path, wc_on_req_result_t callback, void *user)
 

Detailed Description

Typedef Documentation

◆ wc_on_req_result_t

typedef void(* wc_on_req_result_t) (wc_context_t *cnx, int64_t id, wc_action_type_t type, wc_req_pending_result_t status, char *reason, char *data, void *user)

callback type for request status notification

Parameters
cnxthe webcomm connection
idthe request id
typewhat kind of action (wc_action_type_t) is this notification about
statusdid the request succeed (WC_REQ_OK) or failed (WC_REQ_ERROR)
reasonthe success or error reason string
datasome optional JSON data from the server

Function Documentation

◆ wc_datasync_auth()

int64_t wc_datasync_auth ( wc_context_t cnx,
char *  cred,
wc_on_req_result_t  callback,
void *  user 
)

sends an authentication request to the webcom server and get notified of the status

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
creda string containing the secret token
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise
See also
wc_auth_with_password()

◆ wc_datasync_listen()

int64_t wc_datasync_listen ( wc_context_t cnx,
char *  path,
wc_on_req_result_t  callback,
void *  user 
)

sends a listen request to the webcom server and get notified of the status

This function builds and sends a listen request to the webcom server.

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path to listen to
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_merge()

int64_t wc_datasync_merge ( wc_context_t cnx,
char *  path,
char *  json,
wc_on_req_result_t  callback,
void *  user 
)

sends a data merge request to the webcom server and get notified of the status

This function builds and sends a data merge request to the webcom server.

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path of the data
jsona string containing the JSON-encoded data to merge on the server at the given path
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_on_disc_cancel()

int64_t wc_datasync_on_disc_cancel ( wc_context_t cnx,
char *  path,
wc_on_req_result_t  callback,
void *  user 
)

sends an on-disconnect-cancel request to the webcom server and get notified of the status

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path of the data
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_on_disc_merge()

int64_t wc_datasync_on_disc_merge ( wc_context_t cnx,
char *  path,
char *  json,
wc_on_req_result_t  callback,
void *  user 
)

sends an on-disconnect-merge request to the webcom server and get notified of the status

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path of the data
jsona string containing the JSON-encoded data to merge on the server at the given path on disconnection
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_on_disc_put()

int64_t wc_datasync_on_disc_put ( wc_context_t cnx,
char *  path,
char *  json,
wc_on_req_result_t  callback,
void *  user 
)

sends an on-disconnect-put request to the webcom server and get notified of the status

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path of the data
jsona string containing the JSON-encoded data to store on the server at the given path on disconnection
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_push()

int64_t wc_datasync_push ( wc_context_t cnx,
char *  path,
char *  json,
wc_on_req_result_t  callback,
void *  user 
)

sends a data push request to the webcom server and get notified of the status

This function builds and sends a data push request to the webcom server. It slightly differs from the put request: in the push case, the SDK adds a unique, time-ordered, partly random key to the path and sends a put request to this new path.

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path of the data
jsona string containing the JSON-encoded data to push
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_put()

int64_t wc_datasync_put ( wc_context_t cnx,
char *  path,
char *  json,
wc_on_req_result_t  callback,
void *  user 
)

sends a data put request to the webcom server and get notified of the status

This function builds and sends a data put request to the webcom server.

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path of the data
jsona string containing the JSON-encoded data to store on the server at the given path
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_unauth()

int64_t wc_datasync_unauth ( wc_context_t cnx,
wc_on_req_result_t  callback,
void *  user 
)

sends a un-authentication request to the webcom server and get notified of the status

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise

◆ wc_datasync_unlisten()

int64_t wc_datasync_unlisten ( wc_context_t cnx,
char *  path,
wc_on_req_result_t  callback,
void *  user 
)

sends a un-listen request to the webcom server and get notified of the status

This function builds and sends a un-listen request to the webcom server, to stop listening a given path.

Parameters
cnxthe webcom connection
callbackcallback that will be called when the status of the request is sent back from the server
patha string representing the path
usera custom pointer that will be passed to the callback
Returns
the put request id (>0) if it was sent successfully, -1 otherwise