I have Spring server with Spring Websocket support. I would like to use STOMP sub-protocol to handle communication over web sockets, so the configuration of STOMP endpoint looks as follow:
@Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/chat") .setAllowedOrigins("*") .withSockJS(); } } Spring documentation and basically any resource on the topic I was able to find shows how to create STOMP client using SockJS + StompJS. It works but as I understand it shouldn't be needed at all - as STOMP is just a sub-protocol I should be able to communicate with my server basically from any web socket client just by using STOMP messages syntax.
Let's say I just want to connect to my STOMP server from Google Chrome Simple Web Socket Client addon. Accordingly to the STOMP specification first thing which I do is opening web socket connection. I do it with
ws://my.server.here/chat/websocket
link. This part works and my connection is established. Now I want to use STOMP. Again as STOMP specification says I should now send CONNECT command which looks as follows (STOMP 1.1):
CONNECT accept-version:1.0,1.1 host:my.host.here ^@ Then I would expect response from server with CONNECTED command but I get nothing. If instead of "CONNECT" I will use some non-existing command like "WRONG_COMMAND" then I can see Spring exception being thrown about unknown command, so I suppose that my message hits Spring's Websocket internals but I'm unable to get anything back. If this would work I would like to use subsequent SEND, SUBSCRIBE etc. commands to perform operations.
Is this kind of workflow even possible? Am I doing something wrong or maybe I wrongly undrestood the whole idea and the way in which it works?