Example usage for org.springframework.web.socket.config.annotation StompWebSocketEndpointRegistration withSockJS

List of usage examples for org.springframework.web.socket.config.annotation StompWebSocketEndpointRegistration withSockJS

Introduction

In this page you can find the example usage for org.springframework.web.socket.config.annotation StompWebSocketEndpointRegistration withSockJS.

Prototype

SockJsServiceRegistration withSockJS();

Source Link

Document

Enable SockJS fallback options.

Usage

From source file:org.appverse.web.framework.backend.frontfacade.websocket.autoconfigure.FrontFacadeWebSocketAutoConfiguration.java

@Override
public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {

    logger.info("Initializing websocket standard on path:'{}' ...", defaultWebsocketEndpointPath);
    StompWebSocketEndpointRegistration webSockedEndpoint = stompEndpointRegistry
            .addEndpoint(defaultWebsocketEndpointPath);
    logger.info("Initializing websocket sockJs on path:'{}' ...", defaultSockJsEndpointPath);
    StompWebSocketEndpointRegistration sockJsEndpoint = stompEndpointRegistry
            .addEndpoint(defaultSockJsEndpointPath);
    sockJsEndpoint.withSockJS();
    if (Boolean.valueOf(corsEnabled)) {
        logger.info("Initializing cors on websockets");
        webSockedEndpoint.setAllowedOrigins(StringUtils.commaDelimitedListToStringArray(allowedOrigins));
        sockJsEndpoint.setAllowedOrigins(StringUtils.commaDelimitedListToStringArray(allowedOrigins));
    }//from w ww .  j  a va  2 s  . c o  m
}