We're trying to expose sockjs endpoints with Spring Framework WebSocket support.
This is the configuration on the server side where Jersey is managing the routes:
@Configuration
@EnableWebSocket
public class WebSocketConfig extends WebSocketMessageBrokerConfigurationSupport {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/sockjs").withSockJS()
.setStreamBytesLimit(512 * 1024)
.setHttpMessageCacheSize(1000)
.setDisconnectDelay(30 * 1000);
}
}
The problem is that we can't access /sockjs
, the client code is:
List<Transport> transports = new ArrayList<>(2);
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
transports.add(new RestTemplateXhrTransport());
SockJsClient sockJsClient = new SockJsClient(transports);
sockJsClient.doHandshake(new MyHandler(), "ws://localhost:8080/sockjs");
(the code is from spring websockets tutorial)
Other resources in the same package would've configured under root/api/server
, even though, not /sockjs
nor /root/api/server/sockjs
are accessible.