Some questions about autobahnJS.

#1
  1. When logout my app , I need disconnect to autobahnPython server. so I use WS.sess.close(); but this doesn’t work, the app still receive the message from autoPython server.

var WS = {
sess: undefined,
wsuri: WS_URL,
prefix: ‘http://example.com/event/’,
channel: function () {
return ‘u’ + User.uid
},
init: function () {
var _this = this;
ab.connect(_this.wsuri,
function (session) {
_this.sess = session;
_this.sess.prefix(“event”, _this.prefix);
_this.sess.subscribe(“event:” + _this.channel(), _this.subscribeHandle);
},
function (code, reason) {
_this.sess = null;
}
)
},
close: function () {
WS.sess.close();
WS.sess = null;
},
}

0 Likes

#2

i found when I close the sess, console print “Connection lost - scheduled reconnect to occur in 5 second(s)”

how to config when I close manually , don’t reconnect to server.

在 2012年9月12日星期三UTC+8上午11时42分03秒,Keen写道:

···
  1. When logout my app , I need disconnect to autobahnPython server. so I use WS.sess.close(); but this doesn’t work, the app still receive the message from autoPython server.

var WS = {
sess: undefined,
wsuri: WS_URL,
prefix: ‘http://example.com/event/’,
channel: function () {
return ‘u’ + User.uid
},
init: function () {
var _this = this;
ab.connect(_this.wsuri,
function (session) {
_this.sess = session;
_this.sess.prefix(“event”, _this.prefix);
_this.sess.subscribe(“event:” + _this.channel(), _this.subscribeHandle);
},
function (code, reason) {
_this.sess = null;
}
)
},
close: function () {
WS.sess.close();
WS.sess = null;
},
}

0 Likes