-
1. Re: TEXT_FULL_WRITING error in JBoss EAP 6.3 with Web Socket
davidj Sep 30, 2014 7:25 PM (in response to davidj)I found the problem: it was me!
The problem is with how I stored multiple sessions. For example, let's suppose that 3 users have established a websocket. My code was was storing those 3 sessions in a HashSet. Then, when I wanted to send each of them a message, I would loop thru the Set of sessions and for each one do a: session.getBasicRemote().sendText(message); . Trouble is: some of those sessions might have been closed. So I changed my for-loop to have a try/catch block surrounding each "sendText()" call.
WRONG is:
try {
for(Session session : sessions) {
session.getBasicRemote().sendText(message);
}
}
catch(Exception e) {
}
CORRECT is:
for(Session session : sessions) {
try {
session.getBasicRemote().sendText(message);
}
catch(Exception e) {
}
}
Now it works fine. But now there's another problem: How will I know a websocket has closed so I can remove it from my Set of sessions? I thought that when the Javascript called "websocketSession.close()" that the server-side "onClose()" method would get called, but it doesn't. So how will I know?
Thanks.
-
2. Re: TEXT_FULL_WRITING error in JBoss EAP 6.3 with Web Socket
fobos Dec 12, 2016 11:57 PM (in response to davidj)Hi David,
have you solved the problem with ghost websocket sessions ??
Thanks