diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-05-29 12:35:26 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-05-29 12:35:26 +0200 |
commit | 2ea7ffb3abc8c62cfd5235ba4dbcd040f0235d69 (patch) | |
tree | 7481f2ebec982321126fe77e708abe3f8cdd04c4 | |
parent | 6881297e1b8f8e0977088d79cbc417d884cac300 (diff) |
don't enforce to refresh the token
Change-Id: I4257210371c4b809e93c174e00677a82c4b196c7
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-context.c | 2 | ||||
-rw-r--r-- | test/AFB.html | 2 | ||||
-rw-r--r-- | test/AFB.js | 8 | ||||
-rw-r--r-- | test/websock.js | 8 |
4 files changed, 16 insertions, 4 deletions
diff --git a/src/afb-context.c b/src/afb-context.c index 0492ecbf..ba093c37 100644 --- a/src/afb-context.c +++ b/src/afb-context.c @@ -58,7 +58,7 @@ int afb_context_connect(struct afb_context *context, const char *uuid, const cha init_context(context, session, token); if (created) { context->created = 1; - context->refreshing = 1; + /* context->refreshing = 1; */ } return 0; } diff --git a/test/AFB.html b/test/AFB.html index a1a4bf59..b0832d9a 100644 --- a/test/AFB.html +++ b/test/AFB.html @@ -3,7 +3,7 @@ <title>Test of AFB Echo</title> <script type="text/javascript" src="AFB.js"></script> <script type="text/javascript"> - var afb = new AFB("api", "hello-token"); + var afb = new AFB("api", "hello"); var ws; function onopen() { diff --git a/test/AFB.js b/test/AFB.js index ae2fd8b8..c77e5e60 100644 --- a/test/AFB.js +++ b/test/AFB.js @@ -42,7 +42,13 @@ var AFB_websocket; var PROTO1 = "x-afb-ws-json1"; AFB_websocket = function(onopen, onabort) { - this.ws = new WebSocket(urlws, [ PROTO1 ]); + var u = urlws; + if (AFB_context.token) { + u = u + '?x-afb-token=' + AFB_context.token; + if (AFB_context.uuid) + u = u + '&x-afb-uuid=' + AFB_context.uuid; + } + this.ws = new WebSocket(u, [ PROTO1 ]); this.pendings = {}; this.awaitens = {}; this.counter = 0; diff --git a/test/websock.js b/test/websock.js index 84465588..c4295536 100644 --- a/test/websock.js +++ b/test/websock.js @@ -27,12 +27,18 @@ AfbWsItf = (function(){ var RETERR = 4; function AfbWsItf(base, onopen, onabort, ctx) { + ctx = ctx || new AfbCtxItf(); var wl = window.location; var u = "ws://"+wl.host+"/"+base; + if (ctx.token) { + u = u + '?x-afb-token=' + ctx.token; + if (ctx.uuid) + u = u + '&x-afb-uuid=' + ctx.uuid; + } this.ws = new (WebSocket || MozWebSocket)(u, [ "x-afb-ws-json1" ]); this.pendings = {}; this.counter = 0; - this.ctx = ctx || new AfbCtxItf(); + this.ctx = ctx; this.ws.onopen = onopen.bind(this); this.ws.onerror = onerror.bind(this); this.ws.onclose = onclose.bind(this); |