1

I wrote a program for chatting using servlets and websockets implemented in javascript. The problem is that when page is refreshed or user is navigating to other pages websocket connection is terminated (and on next page load it reconnects).

Can I include external js file containing webscokets connection in each page, is it the proper way.

Salvatorelab
  • 11,614
  • 6
  • 53
  • 80
sasi krishna
  • 87
  • 4
  • 10

1 Answers1

0

you can use IFrames or ajax requests to allow "navigation" without reloading the page.

it can be hard to modify the site if it's very big or complex, but if you only have a few pages then there is no problem.

see this similar question: How to maintain a WebSockets connection between pages?

Community
  • 1
  • 1
Salvatorelab
  • 11,614
  • 6
  • 53
  • 80