WebSocket HTTPS connection

See now how start a WebSocket secure connection with a java client. First, create a WebSocket endpoint:

@ServerEndpoint(value = "/session") public class SessionSocketServer {     ...     @OnOpen     public void onOpen(Session session) throws NamingException {       ...    }    @OnMessage     public String onMessage(String message, Session session) {    return "Server received [" + message + "]";     }    @OnClose     public void onClose(Session session) {       ...     }    @OnError     public void onError(Throwable exception, Session session) {       ...     } }

And a basic WebSocket client:

public class SecureSocketClient extends Endpoint {   ...   private static final BlockingDeque<String> queue = new LinkedBlockingDeque<>();   @Override   public void onClose( ...

Get Mastering Java EE Development with WildFly now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.