tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Ricles <>
Subject Send a message from java application to a specific websocket session via Tomcat websocket server
Date Mon, 10 Aug 2015 14:01:06 GMT

I have an application that uses a webpage as the GUI and the backend
is written in Java so thuswebsockets using Apache Tomcat 7 are the way
I am communicating between the GUI and the backend code that does all
the grunt work. A websocket server is the go between, between the
backend code and the GUI part of the application.

Here is the flow of the communication.

>From GUI to backend:


>From backend to GUI:



The problem I am wanting to solve, is if a user request an action to
be done on the GUI and then an error is encountered I want only that
specific user to get an error message not everyone connected to the
site that is the GUI.

The only feasible way I can think of doing this right now, is sending
the session ID of the user requesting the action as part of the
websocket message and then storing that using ID corresponding to the
action requested in something like a HashMap. Then if there is an
error while performing the requested action put some logic in the
websocket server code to extract the session ID from the message being
sent back to the GUI and send the error message to this specific


My question is, is there any simplier way to do this of sending a
message to a specific user between ajava back end and a web page front
end that communicate using web sockets, or is this the only way
possible to achieve what I am trying to do?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message