Example usage for org.springframework.web.socket.handler ConcurrentWebSocketSessionDecorator ConcurrentWebSocketSessionDecorator

List of usage examples for org.springframework.web.socket.handler ConcurrentWebSocketSessionDecorator ConcurrentWebSocketSessionDecorator

Introduction

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

Prototype

public ConcurrentWebSocketSessionDecorator(WebSocketSession delegate, int sendTimeLimit, int bufferSizeLimit) 

Source Link

Document

Basic constructor.

Usage

From source file:com.devicehive.websockets.AbstractWebSocketHandler.java

@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
    logger.debug("Opening session id {} ", session.getId());

    session = new ConcurrentWebSocketSessionDecorator(session, sendTimeLimit, sendBufferSizeLimit);
    HiveWebsocketSessionState state = new HiveWebsocketSessionState();
    session.getAttributes().put(HiveWebsocketSessionState.KEY, state);

    session.getAttributes().put(CommandHandlers.SUBSCSRIPTION_SET_NAME, new CopyOnWriteArraySet<String>());
    session.getAttributes().put(NotificationHandlers.SUBSCSRIPTION_SET_NAME, new CopyOnWriteArraySet<String>());

    sessionMonitor.registerSession(session);
}

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

/**
 * Decorate the given {@link WebSocketSession}, if desired.
 * <p>The default implementation builds a {@link ConcurrentWebSocketSessionDecorator}
 * with the configured {@link #getSendTimeLimit() send-time limit} and
 * {@link #getSendBufferSizeLimit() buffer-size limit}.
 * @param session the original {@code WebSocketSession}
 * @return the decorated {@code WebSocketSession}, or potentially the given session as-is
 * @since 4.3.13/*  w w w. j  a  v a  2 s  .c  o m*/
 */
protected WebSocketSession decorateSession(WebSocketSession session) {
    return new ConcurrentWebSocketSessionDecorator(session, getSendTimeLimit(), getSendBufferSizeLimit());
}