O'Reilly logo

Mastering Java EE Development with WildFly by Luca Stancapiano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required