I am using Spring Websocket with SockJs (v1.1.1) over STOMP on client. I create the client with the code below.
SockJS = require('sockjs-client') Stomp = require('webstomp-client') stompClient = Stomp.over(new SockJS(url)) It's works fine. But it uses xhr_streaming as transport by default, that is not desirable for me. I want to switch it to websocket tranport.
stompClient = Stomp.over(new SockJS(url, null, {transports:'websocket'})) But this approach does not work for me. It falls with event:
code: 2000 reason: "All transports failed" My Spring Websocket configuration is very simple:
@Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractSessionWebSocketMessageBrokerConfigurer<ExpiringSession> { @Override public void configureStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/myEndpoint").setAllowedOrigins("*") .withSockJS(); } @Override public void configureMessageBroker(MessageBrokerRegistry registry) { registry.enableSimpleBroker("/queue/", "/topic/"); registry.setApplicationDestinationPrefixes("/app"); } } The main problem I face with xhr_streaming is that every stream request updates last access time for user session (I use Spring Session as well). But it's not a desirable behavior for my application. So how I can fix it? And will websocket transport help? Thanks in advance.