package edu.javacourse.websocket;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;

/**
 * @author Artem Pronchakov <artem.pronchakov@calisto.email>
 */
@ServerEndpoint("/helloEndpoint")
public class HelloWebSocketEndpoint {

    private static final Logger log = LoggerFactory.getLogger(HelloWebSocketEndpoint.class);

    public HelloWebSocketEndpoint() {
        log.debug("new HelloWebSocketEndpoint()");
    }

    @OnOpen
    public void open(Session session) {
        log.debug("Hello WebSocket opened: id: {}", session.getId());
    }

    @OnMessage
    public String onMessage(String message) {
        return "Hello " + message;
    }

    @OnClose
    public void close(CloseReason reason) {
        log.debug("Hello WebSocket closed: Reason: ", reason.getReasonPhrase());
    }

}

@@ -868,10 +868,284 @@
 %0A    %7D%0A%0A
+    @OnError%0A    public void onError(Session session, Throwable throwable) %7B%0A        log.info(%22The session is an optional parameter. Error happened for session id: %7B%7D%22, session.getId());%0A        log.error(throwable.getMessage());%0A        throwable.printStackTrace();%0A    %7D%0A%0A
 %7D%0A

Add onError in WebSocket example