I am attempting to run a simple websocket example using Tyrus 1.8.3 and the javax.websocket API, following https://blog.openshift.com/how-to-build-java-websocket-applications-using-the-jsr-356-api/ as a guide.
Using annotations, I have created a simple server endpoint and a client endpoint which triggers a method annotated with@OnOpen correctly. However, when I send a message from the client, the method with @OnMessage is not triggered on the server side.
Interestingly, the session id created at onOpen differs between the client and server. I don't understand why and think this may be something to do with the problem? Should the session ids not be the same - there is only one session...
I have also written a simple Javascript client to connect to the same server endpoint and this also does not trigger the @OnMessage method, so I am suspecting there is an issue on the server side.
I have raised the log level to FINE as nothing is reported at INFO level. From the logs it looks like the websocket upgrade is successful and the connection is opened OK. A javax.naming.NoInitialContextException
is thrown on both client and server but I'm not sure if this is relevant...
I have uploaded all of the code to github here: https://github.com/stephenhartley/websocket-demo
The logs files can be viewed in the logs folder.
Could anyone give me some guidance how to trace the cause of this issue?
Many thanks!