Example usage for javax.websocket DecodeException printStackTrace

List of usage examples for javax.websocket DecodeException printStackTrace

Introduction

In this page you can find the example usage for javax.websocket DecodeException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.mac.holdempoker.socket.HoldemEndpoint.java

@Override
public void onMessage(WebSocket ws, String string) {
    try {//w w w . j  a  va  2 s .c om
        Message msg = decoder.decode(string);
        Header h = Header.getHeader(msg.getHeader());
        if (Objects.isNull(h)) {
            return;
        } else if (h == Header.SIGN_IN) {
            boolean added = socketManager.addConnection(msg.getPid(), ws);
            if (!added) {
                System.out.println("Not added");
                return;
            }
        }
        System.out.println(msg.getHeader());
        System.out.println(msg.getPayload());

        handler.handle(msg);
        String jo1 = JsonConverter.toJsonString(simpleGame.getGameState());
        System.out.println(jo1);
        //            ws.send(jo1);
        socketManager.sendToAllOpenConns(jo1);
    } catch (DecodeException ex) {
        ex.printStackTrace();
        java.util.logging.Logger.getLogger(HoldemEndpoint.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        ex.printStackTrace();
        java.util.logging.Logger.getLogger(HoldemEndpoint.class.getName()).log(Level.SEVERE, null, ex);
    }
}