Discussion:
websocket endpoints not released
Alex O'Ree
2018-09-01 00:38:24 UTC
Permalink
I ran into a strange issue today. Running tomcat 8.5 with a websocket
endpoint + some javascript to wire up a browser to the socket. All works as
normal, however sometimes if the user refreshes the browser, it seems as if
second web socket is opened by the browser. This leads to the user seeing
duplicate messages which can be confusing. I do have code on the page for
navigation links to close the socket but i'm thinking i haven't handled all
cases. My assumption was that a full browser reload would trigger any open
websockets to close, but apparently they don't (at least with chrome). Has
anyone else ran into a similar issue?
Johan Compagner
2018-09-05 07:41:44 UTC
Permalink
If a user refreshes the browser then the current ws is always closed and a
new one is opened....
Post by Alex O'Ree
I ran into a strange issue today. Running tomcat 8.5 with a websocket
endpoint + some javascript to wire up a browser to the socket. All works as
normal, however sometimes if the user refreshes the browser, it seems as if
second web socket is opened by the browser. This leads to the user seeing
duplicate messages which can be confusing. I do have code on the page for
navigation links to close the socket but i'm thinking i haven't handled all
cases. My assumption was that a full browser reload would trigger any open
websockets to close, but apparently they don't (at least with chrome). Has
anyone else ran into a similar issue?
Louis Zipes
2018-09-05 11:52:30 UTC
Permalink
Same behavior with Internet Explorer? I know that in general, Chrome tabs act as the same session if you open more than one (at least with my application running on Tomcat)

-----Original Message-----
From: Johan Compagner [mailto:***@servoy.com]
Sent: Wednesday, September 05, 2018 3:42 AM
To: Tomcat Users List
Subject: Re: websocket endpoints not released

- - - external message, proceed with caution - - -


If a user refreshes the browser then the current ws is always closed and a
new one is opened....
Post by Alex O'Ree
I ran into a strange issue today. Running tomcat 8.5 with a websocket
endpoint + some javascript to wire up a browser to the socket. All works as
normal, however sometimes if the user refreshes the browser, it seems as if
second web socket is opened by the browser. This leads to the user seeing
duplicate messages which can be confusing. I do have code on the page for
navigation links to close the socket but i'm thinking i haven't handled all
cases. My assumption was that a full browser reload would trigger any open
websockets to close, but apparently they don't (at least with chrome). Has
anyone else ran into a similar issue?
---------------------------------------
CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure. If you are not the intended recipient, please contact the sender immediately. Unauthorized use or distribution is prohibited and may be unlawful.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-m
Johan Compagner
2018-09-05 12:32:26 UTC
Permalink
Not for me.. websockets are tied to the instance.. and that instance is on
the Dom window which is there 1 per tab.
Post by Louis Zipes
Same behavior with Internet Explorer? I know that in general, Chrome tabs
act as the same session if you open more than one (at least with my
application running on Tomcat)
-----Original Message-----
Sent: Wednesday, September 05, 2018 3:42 AM
To: Tomcat Users List
Subject: Re: websocket endpoints not released
- - - external message, proceed with caution - - -
If a user refreshes the browser then the current ws is always closed and a
new one is opened....
Post by Alex O'Ree
I ran into a strange issue today. Running tomcat 8.5 with a websocket
endpoint + some javascript to wire up a browser to the socket. All works
as
Post by Alex O'Ree
normal, however sometimes if the user refreshes the browser, it seems as
if
Post by Alex O'Ree
second web socket is opened by the browser. This leads to the user seeing
duplicate messages which can be confusing. I do have code on the page for
navigation links to close the socket but i'm thinking i haven't handled
all
Post by Alex O'Ree
cases. My assumption was that a full browser reload would trigger any
open
Post by Alex O'Ree
websockets to close, but apparently they don't (at least with chrome).
Has
Post by Alex O'Ree
anyone else ran into a similar issue?
---------------------------------------
CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and
may contain information that is confidential, proprietary or exempt from
disclosure. If you are not the intended recipient, please contact the
sender immediately. Unauthorized use or distribution is prohibited and may
be unlawful.
---------------------------------------------------------------------
Loading...