aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-context.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-05-13 16:14:16 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-05-13 16:40:41 +0200
commit146f95b776c7a424e672b27386fbb8392bc0ffb7 (patch)
tree890b4ba0c2918609b208b4b8587caa3a1ec179a9 /src/afb-context.c
parentb5cf93aed93e7f331eb645c8afe5317fb67ee50e (diff)
example of integration with websocket in C
The file src/afb-client-demo.c provides an example of how to make a simple C client that connects to the daemon using the websocket protocol x-afb-json1. Change-Id: I31c926b2c42101a53e1ea36b4f67f095614db4a0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-context.c')
-rw-r--r--src/afb-context.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/afb-context.c b/src/afb-context.c
index 2f391dec..62f1f06d 100644
--- a/src/afb-context.c
+++ b/src/afb-context.c
@@ -23,8 +23,7 @@
#include "session.h"
#include "afb-context.h"
-
-void afb_context_init(struct afb_context *context, struct AFB_clientCtx *session, const char *token)
+static void init_context(struct afb_context *context, struct AFB_clientCtx *session, const char *token)
{
assert(session != NULL);
@@ -42,6 +41,11 @@ void afb_context_init(struct afb_context *context, struct AFB_clientCtx *session
}
}
+void afb_context_init(struct afb_context *context, struct AFB_clientCtx *session, const char *token)
+{
+ init_context(context, ctxClientAddRef(session), token);
+}
+
int afb_context_connect(struct afb_context *context, const char *uuid, const char *token)
{
int created;
@@ -50,7 +54,7 @@ int afb_context_connect(struct afb_context *context, const char *uuid, const cha
session = ctxClientGetSession (uuid, &created);
if (session == NULL)
return -1;
- afb_context_init(context, session, token);
+ init_context(context, session, token);
if (created)
context->created = 1;
return 0;