2

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:

Key Lay
  • 366
  • 3
  • 13
  • If I'm not wrong, you are looking for distributed websocket messaging server based on stomp protocol. Something like this might help you: https://stackoverflow.com/questions/26853745/spring-websocket-in-a-tomcat-cluster – Sepehr GH Feb 17 '18 at 08:45
  • Possible duplicate of [Spring Websocket in a tomcat cluster](https://stackoverflow.com/questions/26853745/spring-websocket-in-a-tomcat-cluster) – Sepehr GH Feb 17 '18 at 10:50
  • @SepehrGH unfortunately that is not my use case. I am doing a practice implementation of some distributed system leader election algorithms. I do not need to share sessions across nodes/instances. There are no web browsers involved. – Key Lay Feb 18 '18 at 17:15

1 Answers1

1

I have found some resources that cast some light on how to accomplish this:

  1. http://www.baeldung.com/websockets-api-java-spring-client

  2. https://www.sitepoint.com/implementing-spring-websocket-server-and-client/#javaspringchatclient

  3. http://useof.org/java-open-source/org.springframework.messaging.simp.stomp.StompSessionHandler

number 3 is at least a complete implementation but is unfortunately devoid of comments to explain what's going on.

Key Lay
  • 366
  • 3
  • 13