Andrew
Andrew

Reputation: 334

Jetty Websocket: can't find SimpleEchoSocket

Following Jetty documentation and answer to this question creation of websocket client is as simple as

WebSocketClient client = new WebSocketClient();
SimpleEchoSocket socket = new SimpleEchoSocket();
try {
     client.start();
     URI echoUri = new URI(destUri);
     ClientUpgradeRequest request = new ClientUpgradeRequest();
     client.connect(socket, echoUri, request);
     System.out.printf("Connecting to : %s%n", echoUri);
     socket.awaitClose(5, TimeUnit.SECONDS);
 }

But I can't find SimpleEchoSocket! I try several versions of org.eclipse.jetty.websocket:websocket-client but had no success. Looks like documentation is outdated, but maybe I am doing something wrong? How can I use this example from Jetty doc?

Upvotes: 0

Views: 488

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49545

SimpleEchoSocket is your socket implementation.

In other words, its your code, your class. Something that implements the on open, on close, on message logic in the ways that the same documentation explains.

You have a few choices here, it can be jetty api specific, or jsr-356 (aka javax.websocket) specific.

Then you choose between a traditional class that implements an interface, or one that is marked up with annotations.

Upvotes: 1

Related Questions