1

Hi I've been trying to make a message bus using Spring's Websocket support. There are a number of examples of sockjs clients connecting to Spring applications. I would now like to try using WebSockets to allow two spring applications to communicate in a bi-directional server client scenario.

I have used JHipster as my base, which provides the the Spring foundation (Security,REST,WebSockets, persistence etc..). I've stuck with the embedded Spring SimpleMessageBroker as seen here - https://github.com/jhipster/jhipster-sample-app-websocket

I have also been following the Spring websocket example project as a guide to build the client - https://github.com/rstoyanchev/spring-websocket-portfolio/blob/master/src/test/java/org/springframework/samples/portfolio/web/tomcat/IntegrationPortfolioTests.java

Unfortunately my WebSocketStompClient client is falling over all over the place when connecting. Initially i had issues with spring security and CSRF, after many attempts to mimic the headers of the angular client i just disabled CSRF. Now i'm seeing the HTTP connection upgrade request is rejected.

Can anybody point me in the right direction / materials that are working? (spring example above has failing tests)

NickGDev
  • 56
  • 4
  • 1
    are the two applications under the same domain? – Sergi Almar Sep 02 '15 at 19:16
  • What do you want? A WebSocket client in Java? Why don't you use `javax.websocket` instead of `WebSocketStompClient`? – Takahiko Kawasaki Sep 04 '15 at 16:17
  • I'm attempting to use websockets as a message bus between JHipster and a java client so STOMP seems like a good JMS alternative that provides a lot of meta data about each message. That would allow better support and flexibility in messaging models point to point / pub & sub. So far i've been able to get WebSocketStompClient to connect with spring security completely disabled, i'll publish code shortly on github – NickGDev Sep 07 '15 at 09:38
  • 1
    @NickGDen did you manage to get this to work? I am trying out something similar. – Anand Nadar Sep 24 '15 at 03:04

0 Answers0