Jersey hides Spring and SockJS framework

We are trying to identify sockjs endpoints using Spring WebSocket Framework Support .

This is a server-side configuration where Jersey manages 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 cannot access the /sockjsclient code:

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");

(code from spring website tutorial )

Other resources in the same package will be configured under root/api/server, although not available /sockjsand /root/api/server/sockjs.

+6
source share

Source: https://habr.com/ru/post/1017244/


All Articles