AutobahnJS Chrome Close

#1

Hi,

I’m using AutobahnJS 0.8.2 with the below connection code. This works perfectly in FireFox and in Chrome for the most-part, however when we loose connection to the WS server for whatever reason, FireFox seems to trigger the error function and logs an error to console and auto-reconnects but Chrome does nothing. It simply silently drops the connect to the WS server and dies.

// Start a connection

var conn = new ab.connect(‘wss://127.0.0.1:443’, function(session) {

// Log an error

conn.onerror = function(e) {

console.log('WebSocket error: ’ + e.data);

};

// Subscribe to a topic

session.subscribe(‘topic’, function(topic, data) {

});

}, function (code, reason, detail) {

// Log to console

console.log('WebSocket error: ’ + reason);

}, {

‘skipSubprotocolCheck’: true,

‘maxRetries’: 60,

‘retryDelay’: 1000

});

I need to get the same behaviour in chrome (i.e the auto-reconnect) as I have in firefox. Any ideas?

Thanks

0 Likes

#2

Hi,

Is anybody able to provide any suggestions? I’ve done as much testing as I can and Chrome simply doesn’t seem to notice that the socket connection has gone away.

Thanks

···

On Tuesday, July 1, 2014 12:59:09 PM UTC+1, Jason Yates wrote:

Hi,

I’m using AutobahnJS 0.8.2 with the below connection code. This works perfectly in FireFox and in Chrome for the most-part, however when we loose connection to the WS server for whatever reason, FireFox seems to trigger the error function and logs an error to console and auto-reconnects but Chrome does nothing. It simply silently drops the connect to the WS server and dies.

// Start a connection

var conn = new ab.connect(‘wss://127.0.0.1:443’, function(session) {

// Log an error

conn.onerror = function(e) {

console.log('WebSocket error: ’ + e.data);

};

// Subscribe to a topic

session.subscribe(‘topic’, function(topic, data) {

});

}, function (code, reason, detail) {

// Log to console

console.log('WebSocket error: ’ + reason);

}, {

‘skipSubprotocolCheck’: true,

‘maxRetries’: 60,

‘retryDelay’: 1000

});

I need to get the same behaviour in chrome (i.e the auto-reconnect) as I have in firefox. Any ideas?

Thanks

0 Likes

#3

Jason,

Hi,

Is anybody able to provide any suggestions? I've done as much testing as

Things you can try:

1) enable max logging and compare logs FF/Chrome. maybe it reveals something.

ab.debug(true, true, true);

https://github.com/tavendo/AutobahnJS/blob/wamp1/autobahn/autobahn.js#L264

2) get the non-minimized version, and modify this line

https://github.com/tavendo/AutobahnJS/blob/wamp1/autobahn/autobahn.js#L611

adding console.log there.

probably recent chrome versions changed their behavior.

thing is: the WS API has two hooks

socket.onclose
socket.onerror

and browser beh. might differ

3) guess you are aware that you are using an old AutobahnJS (WAMP1). we are no longer using this ourselfes. what I can say is: the current version of Autobahn (0.9.3) _does_ automatically reconnect, on FF and Chrome, and also via WSS

and it only hooks into socket.onclose:

https://github.com/tavendo/AutobahnJS/blob/master/package/lib/connection.js#L261

which means: 2) isn't a convincing explanation.

4) before loosing even more time, you might try AutobahnJS current against a WAMP2 server in your network/browser env.

even if that (WAMP2) is not what you want, it might help us track down whats going on. since, as mentioned, this (AB current) definitely works with automatic reconnects on chrome.

/Tobias

···

Am 03.07.2014 23:34, schrieb Jason Yates:

I can and Chrome simply doesn't seem to notice that the socket
connection has gone away.

Thanks

On Tuesday, July 1, 2014 12:59:09 PM UTC+1, Jason Yates wrote:

    Hi,

    I'm using AutobahnJS 0.8.2 with the below connection code. This
    works perfectly in FireFox and in Chrome for the most-part, however
    when we loose connection to the WS server for whatever reason,
    FireFox seems to trigger the error function and logs an error to
    console and auto-reconnects but Chrome does nothing. It simply
    silently drops the connect to the WS server and dies.

        // Start a connection
         var conn = new ab.connect('wss://127.0.0.1:443
    <http://127.0.0.1:443>', function(session) {

             // Log an error
             conn.onerror = function(e) {
                 console.log('WebSocket error: ' + e.data);
             };

             // Subscribe to a topic
             session.subscribe('topic', function(topic, data) {
             });

         }, function (code, reason, detail) {

             // Log to console
             console.log('WebSocket error: ' + reason);
         }, {
             'skipSubprotocolCheck': true,
             'maxRetries': 60,
             'retryDelay': 1000
         });

    I need to get the same behaviour in chrome (i.e the auto-reconnect)
    as I have in firefox. Any ideas?

    Thanks

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
To post to this group, send email to autob...@googlegroups.com
<mailto:autob...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/autobahnws/318037c3-9b52-45eb-a1f3-676f245b12c6%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/318037c3-9b52-45eb-a1f3-676f245b12c6%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes