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

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

Introduction

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

Prototype

SockJsServiceRegistration withSockJS();

Source Link

Document

Enable SockJS fallback options.

Usage

From source file:ymanv.forex.websocket.WebSocketConfigurator.java

@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    WebSocketHandlerRegistration wshr = registry.addHandler(handler, "/latest");
    wshr.withSockJS();
}

From source file:org.kurento.jsonrpc.internal.server.config.JsonRpcConfiguration.java

private void publishWebSocketEndpoint(WebSocketHandlerRegistry wsHandlerRegistry, JsonRpcHandler<?> handler,
        List<String> paths) {

    ProtocolManager protocolManager = (ProtocolManager) ctx.getBean("protocolManager", handler);

    JsonRpcWebSocketHandler wsHandler = new JsonRpcWebSocketHandler(protocolManager);

    protocolManager.setPingWachdog(handler.isPingWatchdog());

    for (String path : paths) {

        WebSocketHandlerRegistration registration = wsHandlerRegistry.addHandler(wsHandler, path);

        if (handler.isSockJSEnabled()) {
            registration.withSockJS().setSessionCookieNeeded(false);
            // .setClientLibraryUrl(
            // "../../bower_components/sockjs/sockjs.js");
        }/*from   w w  w . j av a  2 s  .co m*/

        if (handler.getLabel() != null) {
            wsHandler.setLabel(handler.getLabel());
        }
    }
}