Issue
I have multiple instances using Spring Boot WebSocket (created following the first half of Spring's guide). I need them to connect to other instances at specific hostnames and ports and to be able to send messages over the websocket connection using STOMP protocol.
How can I connect to my other services over websocket?
How can I send messages using the STOMP protocol (preferably using the same marshalling/unmarshalling magic I get with received messages)?
Things that don't answer my question:
- I have read Spring: send message to websocket clients and Sending message to specific user on Spring Websocket but these and other questions seem to all assume that a client has already initiated a connection and that there are users and topics established. This is not my use case as my services are both server AND client.
- I am not using a cluster and I am not sharing sessions across instances as in Spring Websocket in a tomcat cluster
Solution
I eventually was successful in my implementation. You can view it here: https://github.com/BraveNewPumpkin/LeaderElectionPractice
Answered By - Key Lay
Answer Checked By - Marilyn (JavaFixing Volunteer)