Skip to content

Commit

Permalink
Merge pull request crossbario#28 from ewollesen/master
Browse files Browse the repository at this point in the history
Allows AutobahnJS to be quieter
  • Loading branch information
Tobias Oberstein committed Jun 26, 2013
2 parents e6185f1 + 8620655 commit f3cec72
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions autobahn/autobahn.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ ab.log = function () {
ab._debugrpc = false;
ab._debugpubsub = false;
ab._debugws = false;
ab._debugconnect = true;

ab.debug = function (debugWamp, debugWs) {
if ("console" in window) {
Expand Down Expand Up @@ -961,10 +962,14 @@ ab._connect = function (peer) {
maxretries: peer.options.maxRetries});

if (!stop) {
console.log("Connection unreachable - retrying (" + peer.retryCount + ") ..");
if (ab._debugconnect) {
console.log("Connection unreachable - retrying (" + peer.retryCount + ") ..");
}
window.setTimeout(ab._connect, peer.options.retryDelay, peer);
} else {
console.log("Connection unreachable - retrying stopped by app");
if (ab._debugconnect) {
console.log("Connection unreachable - retrying stopped by app");
}
peer.onHangup(ab.CONNECTION_RETRIES_EXCEEDED, "Number of connection retries exceeded.");
}

Expand All @@ -988,10 +993,14 @@ ab._connect = function (peer) {
maxretries: peer.options.maxRetries});

if (!stop) {
console.log("Connection lost - retrying (" + peer.retryCount + ") ..");
if (ab._debugconnect) {
console.log("Connection lost - retrying (" + peer.retryCount + ") ..");
}
window.setTimeout(ab._connect, peer.options.retryDelay, peer);
} else {
console.log("Connection lost - retrying stopped by app");
if (ab._debugconnect) {
console.log("Connection lost - retrying stopped by app");
}
peer.onHangup(ab.CONNECTION_RETRIES_EXCEEDED, "Connection lost.");
}
} else {
Expand Down Expand Up @@ -1045,7 +1054,9 @@ ab.connect = function (wsuri, onconnect, onhangup, options) {

if (!onhangup) {
peer.onHangup = function (code, reason, detail) {
console.log(code, reason, detail);
if (ab._debugconnect) {
console.log(code, reason, detail);
}
}
} else {
peer.onHangup = onhangup;
Expand Down

0 comments on commit f3cec72

Please sign in to comment.