Example usage for org.springframework.web.socket.handler WebSocketSessionDecorator unwrap

List of usage examples for org.springframework.web.socket.handler WebSocketSessionDecorator unwrap

Introduction

In this page you can find the example usage for org.springframework.web.socket.handler WebSocketSessionDecorator unwrap.

Prototype

public static WebSocketSession unwrap(WebSocketSession session) 

Source Link

Usage

From source file:org.springframework.web.socket.messaging.StompSubProtocolHandler.java

private StompHeaderAccessor afterStompSessionConnected(Message<?> message, StompHeaderAccessor accessor,
        WebSocketSession session) {/*from w  ww  .  jav a 2s.com*/

    Principal principal = getUser(session);
    if (principal != null) {
        accessor = toMutableAccessor(accessor, message);
        accessor.setNativeHeader(CONNECTED_USER_HEADER, principal.getName());
    }

    long[] heartbeat = accessor.getHeartbeat();
    if (heartbeat[1] > 0) {
        session = WebSocketSessionDecorator.unwrap(session);
        if (session instanceof SockJsSession) {
            ((SockJsSession) session).disableHeartbeat();
        }
    }

    return accessor;
}