WebSockets with multiple tabs/windows

Tag: playframework-2.0 Author: zhangpeng2006 Date: 2013-07-06

I'm seeing some strange behaviour when using websockets with Play 2.1.2 and multiple tabs/windows.

When there is one tab/window all works as expected. However, if I open another tab/window to the same location, the first tab/window's socket connection is closed. (i.e. the in.onClose() callback is invoked for the first socket) Basically, only the last opened tab/window now has an open socket connection.

Why is this? Am I doing/understanding something wrong or is this a bug?

Small sample project is here: https://github.com/donovanmuller/ws-multi-test

This shouldn't be the case - each Browser tab/window should be independent of the other. What browser are you using?
Perhaps test with other browsers also
Hi Christopher, I'm testing with Chrome 28.0.1500.71.
Haves tested with Firefox 22.0 with the same result. Just re-checked and it's even happening on windows from two different browsers. I.e. I load up Firefox and all is good. Then load up Chrome and Firefox socket is closed... Got a suspicion I'm doing something wrong, any idea what?

Best Answer

Seems to have fixed itself :) I updated to the latest 2.1.x release (2.1.5) so that might have something to do with it.

The example project above now behaves as expected.