public class WSClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
WSClient.Builder |
static class |
WSClient.InputMessageEncoder |
| Constructor and Description |
|---|
WSClient(URI serverUri,
ClientMessageListener... listeners) |
WSClient(WSClient.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect(int timeout)
Connect to server endpoint.
|
void |
disconnect() |
URI |
getServerUri() |
boolean |
isConnected() |
void |
onClose(javax.websocket.Session session,
javax.websocket.CloseReason closeReason) |
void |
onError(Throwable error) |
void |
onOpen(javax.websocket.Session session) |
void |
processBinaryMessage(byte[] message) |
void |
processTextMessage(String message) |
void |
send(byte[] message) |
void |
send(InputMessage message) |
void |
send(String message) |
void |
subscribeToChannel(String channel) |
void |
unsubscribeFromChannel(String channel) |
public WSClient(URI serverUri, ClientMessageListener... listeners)
public WSClient(WSClient.Builder builder)
public void connect(int timeout)
throws IOException,
javax.websocket.DeploymentException
timeout - connection timeout value in secondsIOException - if connection failedSocketTimeoutException - if timeout occurs while try to connect to server endpointIllegalArgumentException - if timeout zero or negativejavax.websocket.DeploymentExceptionpublic void disconnect()
throws IOException
IOExceptionpublic URI getServerUri()
public boolean isConnected()
public void send(String message) throws IOException
IOExceptionpublic void send(byte[] message)
throws IOException
IOExceptionpublic void send(InputMessage message) throws IOException, javax.websocket.EncodeException
IOExceptionjavax.websocket.EncodeExceptionpublic void subscribeToChannel(String channel) throws IOException
IOExceptionpublic void unsubscribeFromChannel(String channel) throws IOException
IOExceptionpublic void onOpen(javax.websocket.Session session)
public void processTextMessage(String message)
public void processBinaryMessage(byte[] message)
public void onClose(javax.websocket.Session session,
javax.websocket.CloseReason closeReason)
public void onError(Throwable error)
Copyright © 2012–2016 Codenvy, S.A.. All rights reserved.