Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
jobs: Fix locks in event loops
[src/app-framework-binder.git]
/
test
/
websock.js
diff --git
a/test/websock.js
b/test/websock.js
index
1ba136b
..
c429553
100644
(file)
--- a/
test/websock.js
+++ b/
test/websock.js
@@
-27,12
+27,18
@@
AfbWsItf = (function(){
var RETERR = 4;
function AfbWsItf(base, onopen, onabort, ctx) {
var RETERR = 4;
function AfbWsItf(base, onopen, onabort, ctx) {
+ ctx = ctx || new AfbCtxItf();
var wl = window.location;
var u = "ws://"+wl.host+"/"+base;
var wl = window.location;
var u = "ws://"+wl.host+"/"+base;
- this.ws = new (WebSocket || MozWebSocket)(u, [ "afb1", "afb2" ]);
+ 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.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);
this.ws.onopen = onopen.bind(this);
this.ws.onerror = onerror.bind(this);
this.ws.onclose = onclose.bind(this);