@ServerEndpoint("/testendpoint")
public class TestEndpoint {
...
@OnError
public void error(Session session, Throwable t) {
t.printStackTrace();
...
}
}
|
Java Platform, Enterprise Edition (Java EE) 8 The Java EE Tutorial |
| Previous | Next | Contents |
To designate a method that handles errors in an annotated WebSocket
endpoint, decorate it with @OnError:
@ServerEndpoint("/testendpoint")
public class TestEndpoint {
...
@OnError
public void error(Session session, Throwable t) {
t.printStackTrace();
...
}
}
This method is invoked when there are connection problems, runtime errors from message handlers, or conversion errors when decoding messages.
| Previous | Next | Contents |
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.