I have followed this tutorial to build a Spring Boot application that serves websockets connections but I can't connect to these websockets from other clients than the one served by Spring Boot itself.
The complete directory in the GitHub repository that accompanies the tutorial contains the final Spring Boot code. I took the index.html and the app.js files from this repository and created another client that runs on a Node.js server. After that, I replaced the connection strings to point to localhost:8080 (where Spring Boot is running). Then I ran the Node.js server and tried to use the websockets, but it does not work.
The first problem was easily solved by adding .setAllowedOrigins("*") to the StompEndpointRegistry registry. With this configuration, I managed to connect to the websocket, but now I never get a message back from the socket.
I wonder what am I missing... Does any one know what is the problem?
The extracted index.html and app.js (renamed to index.js) files, and the Node.js server can be found here for testing purposes. To run it, simply install the dependencies (npm install) and then issue npm start. The server will respond on http://localhost:3000/.