users@websocket-spec.java.net

[jsr356-users] Annotated _at_ClientEndpoints: How does a Client Connect To A Remote Endpoint?

From: <peter.pilgrim_at_gmail.com>
Date: Tue, 12 Mar 2013 00:01:22 +0000 (GMT)

Hello All

Annotated @ClientEndpoints: How does a Client Connect To A Remote
Endpoint?

How does a developer connect the remote WebSocket with just
annotations?

import javax.websocket.ClientEndpoint;
import javax.websocket.OnMessage;
import javax.websocket.Session;

@ClientEndpoint
public class ClientEchoEndpoint {

    @OnMessage
    public void messageReceived( Session session, String text ) {
        System.out.printf("message from the server text: %s\n", text);
    }
}

Assuming the code runs inside a Java EE7 container.

Also is the client side programmatic API example out there for
everybody to see?