Example usage for org.springframework.web.socket CloseStatus SERVER_ERROR

List of usage examples for org.springframework.web.socket CloseStatus SERVER_ERROR

Introduction

In this page you can find the example usage for org.springframework.web.socket CloseStatus SERVER_ERROR.

Prototype

CloseStatus SERVER_ERROR

To view the source code for org.springframework.web.socket CloseStatus SERVER_ERROR.

Click Source Link

Document

"1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."

Usage

From source file:org.springframework.web.socket.support.ExceptionWebSocketHandlerDecorator.java

public static void tryCloseWithError(WebSocketSession session, Throwable exception, Log logger) {
    logger.error("Closing due to exception for " + session, exception);
    if (session.isOpen()) {
        try {/*from  ww w .j av  a  2  s .c o m*/
            session.close(CloseStatus.SERVER_ERROR);
        } catch (Throwable t) {
            // ignore
        }
    }
}