silently reconnect in autobahn.js

#1

Hi Thomas,

I don’t quite agree that a silent reconnect is a good choice.

I’ve added a
peer.onHangup(ab.CONNECTION_UNREACHABLE_SCHEDULED_RECONNECT, “Connection unreachable - scheduled reconnect to occur in " + (peer.options.retryDelay/1000) + " second(s).”);
and a
peer.onHangup(ab.CONNECTION_LOST_SCHEDULED_RECONNECT, “Connection lost - scheduled reconnect to occur in " + (peer.options.retryDelay/1000) + " second(s).”);

where
ab.CONNECTION_UNREACHABLE_SCHEDULED_RECONNECT = 5;
ab.CONNECTION_LOST_SCHEDULED_RECONNECT = 6;

after the respective
// silently reconnect
window.setTimeout(…

The reason for this is that you may want to update the ui when the connection drops or schedules a to reconnect. Actually all the paths in the switch statement and the surrounding function should somehow call that onHangup function for that reason.

Cheers,
Daniel

0 Likes

#2

Outch, sorry, I meant to say Tobias.

BTW, I noticed that the wamp.py doesn’t have an automatic reconnect mechanism, am I missing something or is this in purpose?

···

On Wednesday, April 4, 2012 10:03:49 PM UTC+2, Daniel F. wrote:

Hi Thomas,

I don’t quite agree that a silent reconnect is a good choice.

I’ve added a
peer.onHangup(ab.CONNECTION_UNREACHABLE_SCHEDULED_RECONNECT, “Connection unreachable - scheduled reconnect to occur in " + (peer.options.retryDelay/1000) + " second(s).”);
and a
peer.onHangup(ab.CONNECTION_LOST_SCHEDULED_RECONNECT, “Connection lost - scheduled reconnect to occur in " + (peer.options.retryDelay/1000) + " second(s).”);

where
ab.CONNECTION_UNREACHABLE_SCHEDULED_RECONNECT = 5;
ab.CONNECTION_LOST_SCHEDULED_RECONNECT = 6;

after the respective
// silently reconnect
window.setTimeout(…

The reason for this is that you may want to update the ui when the connection drops or schedules a to reconnect. Actually all the paths in the switch statement and the surrounding function should somehow call that onHangup function for that reason.

Cheers,
Daniel

0 Likes

#3

BTW, I noticed that the wamp.py doesn't have an automatic reconnect
mechanism, am I missing something or is this in purpose?

Neither nor;) Just no time yet to implement it .. was more acute in
AutobahnJS.

0 Likes

#4

The reason for this is that you may want to update the ui when the
connection drops or schedules a to reconnect. Actually all the paths in
the switch statement and the surrounding function should somehow call
that onHangup function for that reason.

sounds reasonable. could you make up a patch? that is: fork me on github, do your changes and send me a pull request?

0 Likes