You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thomas Heigl <th...@umschalt.com> on 2020/03/20 11:14:36 UTC

Websockets with shared resource and multiple browser tabs

Hi all,

I'm currently implementing native websockets for my application. I'm using
`WebSocketResource` because I don't need access to the page and do not want
my page to lock on websocket messages.

Everything works, but I encountered one issue: It is not possible to
support websocket connections for multiple tabs in the same browser because
the key used for looking up the websocket connection is the name of the
shared resource. Since this is the same for all open browser tabs, existing
connections get overwritten when the user opens a new tab.

I experimented with appending a unique token to the resource name as a
query parameter, but then the websocket broadcaster cannot find the shared
resource.

It is possible to somehow add a shared resource that supports query
parameters? Or is there some other way to use a separate websocket
connection per browser tab?

Thanks,

Thomas

Re: Websockets with shared resource and multiple browser tabs

Posted by Thomas Heigl <th...@umschalt.com>.
Hi all,

I created a ticket (https://issues.apache.org/jira/browse/WICKET-6761) and
a PR (https://github.com/apache/wicket/pull/417) for this.

Best,

Thomas

On Fri, Mar 20, 2020 at 12:14 PM Thomas Heigl <th...@umschalt.com> wrote:

> Hi all,
>
> I'm currently implementing native websockets for my application. I'm using
> `WebSocketResource` because I don't need access to the page and do not want
> my page to lock on websocket messages.
>
> Everything works, but I encountered one issue: It is not possible to
> support websocket connections for multiple tabs in the same browser because
> the key used for looking up the websocket connection is the name of the
> shared resource. Since this is the same for all open browser tabs, existing
> connections get overwritten when the user opens a new tab.
>
> I experimented with appending a unique token to the resource name as a
> query parameter, but then the websocket broadcaster cannot find the shared
> resource.
>
> It is possible to somehow add a shared resource that supports query
> parameters? Or is there some other way to use a separate websocket
> connection per browser tab?
>
> Thanks,
>
> Thomas
>