public class WebSocketConnection extends java.lang.Object implements WebSocketSender
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connect to websocket
|
void |
interrupt()
Interrupt connect method.
|
void |
sendByteMessage(byte[] buffer)
Send binary message (thread safe).
|
void |
sendPingMessage(byte[] buffer)
Send ping request (thread safe).
|
void |
sendStringMessage(java.lang.String message)
Send text message (thread safe).
|
public void connect()
throws WrongWebsocketResponse,
java.lang.InterruptedException,
java.io.IOException
java.net.UnknownHostException - when could not connect to selected hostjava.io.IOException - thrown when I/O exception occurWrongWebsocketResponse - thrown when wrong web socket response receivedjava.lang.InterruptedException - thrown when interrupt method was invokedpublic void sendByteMessage(@Nonnull
byte[] buffer)
throws java.io.IOException,
java.lang.InterruptedException,
NotConnectedException
WebSocketSendersendByteMessage in interface WebSocketSenderbuffer - buffer to sendjava.io.IOException - when exception occur while sendingjava.lang.InterruptedException - when user call disconnectNotConnectedException - when called before onConnect or after onDisconnectpublic void sendPingMessage(@Nonnull
byte[] buffer)
throws java.io.IOException,
java.lang.InterruptedException,
NotConnectedException
WebSocketSendersendPingMessage in interface WebSocketSenderbuffer - buffer to sendjava.io.IOException - when exception occur while sendingjava.lang.InterruptedException - when user call disconnectNotConnectedException - when called before onConnect or after onDisconnectpublic void sendStringMessage(@Nonnull
java.lang.String message)
throws java.io.IOException,
java.lang.InterruptedException,
NotConnectedException
WebSocketSendersendStringMessage in interface WebSocketSendermessage - message to sendjava.io.IOException - when exception occur while sendingjava.lang.InterruptedException - when user call disconnectNotConnectedException - when called before onConnect or after onDisconnectpublic void interrupt()