Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

history.back() breaks connection in chrome browser #21

Closed
neowizdom opened this issue Jul 9, 2013 · 9 comments
Closed

history.back() breaks connection in chrome browser #21

neowizdom opened this issue Jul 9, 2013 · 9 comments

Comments

@neowizdom
Copy link

I have the sse running in a frame to maintain the persistent connection while navigating to various pages in a different frame. Whenever I click the "back" button, the connection to the server is lost. It will reconnect after the heartbeat timeout. Is this expected behavior? This does not happen when using IE.

@Yaffle
Copy link
Owner

Yaffle commented Jul 9, 2013

Seems, Chrome stops request and fires abort event...

@Yaffle
Copy link
Owner

Yaffle commented Jul 9, 2013

@Yaffle
Copy link
Owner

Yaffle commented Jul 9, 2013

similar problem with native EventSource

@tshemsedinov
Copy link

It is better to establish SSE connection in worker

@neowizdom
Copy link
Author

Putting SSE in a worker does not help. The same behavior exists: hitting the back button aborts the connection and causes SSE to reconnect after the heartbeat timeout. Using the native EventSource, it will never reconnect.

Another annoying behavior with Chrome is that while the SSE is running in one frame, and you navigate to other pages in a different frame, the page load will stall until the SSE connection is manually broken from the server side. Only then will it continue to load the rest of the elements on the page. It looks like all the GET's (to fetch images, etc) are pending and will not continue until either the SSE request completes or is broken. It's like the browser thinks all of the concurrent connections are in use and won't continue to load until the SSE completes even though its the only active connection.

It seems that SSE is not well suited for frames. This is unfortunate as this seems like an ideal place to create a persistent connection to the server. I want a static frame that is always around to receive events while the user navigates through the site in another frame.

Any other ideas/suggestions?

@tshemsedinov
Copy link

Try SHARED web worker new SharedWorker("file.js"); it is separated from page context and back button can't affect this type of workers

@neowizdom
Copy link
Author

That seems to work for Chrome. However, SharedWorkers are not yet common in all current browsers so that means I'll have to do some custom browser detection.

@Yaffle
Copy link
Owner

Yaffle commented Jul 10, 2013

with frames you will have issues not only with EventSource, but with XHR and may be some other staff too

@Yaffle
Copy link
Owner

Yaffle commented Aug 14, 2013

Chrome should reconnect after "retry" delay now

@Yaffle Yaffle closed this as completed Dec 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants