javax.websocket
Annotation Type WebSocketClient


@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface WebSocketClient

The WebSocketClient annotation a class level annotation is used to denote that a POJO is a web socket client and can be deployed as such. Similar to WebSocketEndpoints, POJOs that are annotated with this annotation can have methods that, using the web socket method level annotations, are web socket lifecycle methods.

For example:


  @WebSocketClient(subprotocols="chat")
 public class HelloServer {

   @WebSocketMessage
  public void processMessageFromServer(String message, Session session) {
    System.out.println("Message came from the server ! " + message);
  }
 }
 
 

Since:
version 008
Author:
dannycoward

Optional Element Summary
 Class<? extends Decoder>[] decoders
          The array of Java classes that are to act as Decoders for messages coming into the client.
 Class<? extends Encoder>[] encoders
          The array of Java classes that are to act as Encoders for messages sent by the client.
 String[] subprotocols
          The names of the subprotocols this client supports.
 

subprotocols

public abstract String[] subprotocols
The names of the subprotocols this client supports.

Returns:
the array of names of the subprotocols.
Default:
{}

decoders

public abstract Class<? extends Decoder>[] decoders
The array of Java classes that are to act as Decoders for messages coming into the client.

Returns:
the array of decoders.
Default:
{}

encoders

public abstract Class<? extends Encoder>[] encoders
The array of Java classes that are to act as Encoders for messages sent by the client.

Returns:
the array of decoders.
Default:
{}



Copyright © 2012-2013 Oracle and/or its affiliates. All rights reserved.