Jetty Websockets: share connection among many tabs

2019-09-06 15:38发布

问题:

What I have: I use Jetty Websockets and jquery + backbone.js on my client side. Each time user open a new tab, he get new websocket connection and must to log in again.

What I want: I want user haven't to log in each time he open new tab. Instead if he's already logged in one tab, new tabs will automatically log in him and redirect him to the home page.

Questions:

  1. What is better: share the same websocket connection between many tabs or store user credentials and automatically relogin on new tab opening?
  2. How can I do that? Provide a little example please?