How to Write a Java based Spring Web Socket (STOMP) Client. As in Spring we have only javascript based client is provided using stompJS but if we need a java client how should we need to achive it?
2 Answers
Spring 4.1 introduces a SockJs Java Client which is quite useful for server to server communication and performance testing. It doesn't come with a Stomp client (this is certainly in the roadmap) but you can check out the tests in the sample app which has already an implementation. Seems this is what you are looking for.
Update 8 Sep 2015:
Spring 4.2 has a STOMP Java client which can be used along with the SockJS Java client. More: https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/htmlsingle/#websocket-stomp-client
6 Comments
cannot be resolved to a type for all. I have added all the jars. I have copied all the jars form the Gradle local repo. I have searched for existance of those class in all jars but I did not get them. I fell all the class are renamed and packages are changed. This URL snag.gy/Y9QCy.jpg is the screenshot of what I coded. And I did't get any Idea form the code in git repo. Please can you provide me a sample code.StandardWebSocketClient() and MyWebSocketHandler(). Also tell how to exactly replace the index.html (a js client) from the tutorial to this java client.I would look for websocket clients in Java and build off of those. It seems that Jetty has a websocket client api as does too tall nate.