0

Using Faye for active client connections. I have my users confirm to leave page through some JS:

window.onbeforeunload = page_leave; 
function page_leave() { 
        return "All open sessions will be disconnected."; 
}

If the user chooses to stay on the page, faye no longer works. (Messages are no longer sent or received.) Perhaps there is something in faye.js that kills the connection in the onbeforeunload event? Is there a way around this?

I'm using Chrome on OSX. Happens every time. Haven't tested other browsers yet.

4

1 回答 1

1

Looks like faye closes connections in the beforeunload event. Topic has been discussed here: http://groups.google.com/group/faye-users/browse_thread/thread/83165b2c6e30af8a

UPDATE: In newer versions of Faye there is an option to turn this off:

client.disable('autodisconnect');
于 2011-11-09T16:10:25.283 回答