diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2016-05-29 23:41:40 +0200 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2016-05-29 23:41:40 +0200 |
commit | 26bca5f8a8c6f9403a84945a5cd914b6da948efd (patch) | |
tree | 88469dc3eaa063b3d773d5221fe3cb67e9b04cc0 /test/websock.js | |
parent | 706bc5c7e0db5f7a782f80ab99fa8fe005289f8d (diff) | |
parent | 2ea7ffb3abc8c62cfd5235ba4dbcd040f0235d69 (diff) |
Merge branch 'master' of https://github.com/iotbzh/afb-daemon
Diffstat (limited to 'test/websock.js')
-rw-r--r-- | test/websock.js | 8 |
1 files changed, 7 insertions, 1 deletions
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); |