0

Does anybody know if it is possible to capture something like a resource or connection id using the HTML WebSocket specification so that you can re-use or reopen a connection from a previous page. Use case would be I establish a web socket connection while on one page, then the user navigates to a separate page but I don't want to re-establish a new connection but rather use the previous one. You may be asking 'why let the user completely refresh the page?' and it's a legitimate question but not for this use case :)

Thanks.

  • You mean by "navigates to a separate page" that original page with active connection will be closed or it will stay opened and connected? – yojimbo87 Apr 20 '11 at 07:56
  • By navigating to a seperate page I mean that the user performs a get or post request that displays a new page in the browser. –  Apr 21 '11 at 02:40

1 Answers1

0

If you open a new tab in your browser context and the original is still connected you can use for example HTML5 storage to pass messages between tabs. With this approach only the first tab will be connected with server through WebSockets and communication can be stored to local storage. Other tabs would handle storage events and thus they don't need to be connected.

yojimbo87
  • 65,684
  • 25
  • 123
  • 131