tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Ricles <jgr...@alum.lehigh.edu>
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
Introduction:

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:

GUI-->WebSocketServer-->Backend

>From backend to GUI:

Backend-->WebSocketServer-->Backend

Problem:

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
session.

Question:

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message