src/main/java/zoot/tube/websocketserver/Server.java
/**
     * Runs whenever a web socket connection is made to this server.
     * <p>
     * Note: we only allow a single connection at a time. So if a new
     * connection is made, the old connection gets closed.
     *
     * @param conn      the new connection.
     * @param handshake no clue what this is.
     */
Runs whenever a web socket connection is made to this server.

Note: we only allow a single connection at a time. So if a new
connection is made, the old connection gets closed.

@param conn      the new connection.
@param handshake no clue what this is.
Runs whenever a web socket connection is made to this server . Note : we only allow a single connection at a time . So if a new connection is made the old connection gets closed . @param conn the new connection . @param handshake no clue what this is .
@Override
    public void onOpen(WebSocket conn, ClientHandshake handshake) {
        if (this.conn != null) {
            System.out.println("New connection made. Dropping old one.");
            this.conn.close();
        }
        System.out.println(String.format("Connection opened to: %s", conn.getRemoteSocketAddress()));
        this.conn = conn;
    }
@ Override public void onOpen ( WebSocket conn , ClientHandshake handshake ) { if ( this . conn != null ) { System . out . println ( "New connection made. Dropping old one." ) ; this . conn . close ( ) ; } System . out . println ( String . format ( "Connection opened to: %s" , conn . getRemoteSocketAddress ( ) ) ) ; this . conn = conn ; }
Runs whenever a web socket connection is made to this server.
Runs whenever a web socket connection is made to this server .