Modifier and Type | Method and Description |
---|---|
WebSocket |
WebSocket.addExtension(String extension)
Add a value for
Sec-WebSocket-Extension . |
WebSocket |
WebSocket.addExtension(WebSocketExtension extension)
Add a value for
Sec-WebSocket-Extension . |
WebSocket |
WebSocket.addHeader(String name,
String value)
Add a pair of extra HTTP header.
|
WebSocket |
WebSocket.addListener(WebSocketListener listener)
Add a listener to receive events on this WebSocket.
|
WebSocket |
WebSocket.addListeners(List<WebSocketListener> listeners)
Add listeners.
|
WebSocket |
WebSocket.addProtocol(String protocol)
Add a value for
Sec-WebSocket-Protocol . |
WebSocket |
WebSocket.clearExtensions()
Remove all extensions from
Sec-WebSocket-Extension . |
WebSocket |
WebSocket.clearHeaders()
Clear all extra HTTP headers.
|
WebSocket |
WebSocket.clearListeners()
Remove all the listeners from this WebSocket.
|
WebSocket |
WebSocket.clearProtocols()
Remove all protocols from
Sec-WebSocket-Protocol . |
WebSocket |
WebSocket.clearUserInfo()
Clear the credentials to connect to the WebSocket endpoint.
|
WebSocket |
WebSocket.connect()
Connect to the server, send an opening handshake to the server,
receive the response and then start threads to communicate with
the server.
|
WebSocket |
WebSocket.connectAsynchronously()
Execute
connect() asynchronously by creating a new thread and
calling connect() in the thread. |
WebSocket |
WebSocketFactory.createSocket(String uri)
Create a WebSocket.
|
WebSocket |
WebSocketFactory.createSocket(String uri,
int timeout)
Create a WebSocket.
|
WebSocket |
WebSocketFactory.createSocket(URI uri)
Create a WebSocket.
|
WebSocket |
WebSocketFactory.createSocket(URI uri,
int timeout)
Create a WebSocket.
|
WebSocket |
WebSocketFactory.createSocket(URL url)
Create a WebSocket.
|
WebSocket |
WebSocketFactory.createSocket(URL url,
int timeout)
Create a WebSocket.
|
WebSocket |
WebSocket.disconnect()
Disconnect the WebSocket.
|
WebSocket |
WebSocket.disconnect(int closeCode)
Disconnect the WebSocket.
|
WebSocket |
WebSocket.disconnect(int closeCode,
String reason)
Disconnect the WebSocket.
|
WebSocket |
WebSocket.disconnect(int closeCode,
String reason,
long closeDelay)
Disconnect the WebSocket.
|
WebSocket |
WebSocket.disconnect(String reason)
Disconnect the WebSocket.
|
WebSocket |
WebSocket.flush()
Flush frames to the server.
|
WebSocket |
WebSocket.recreate()
Create a new
WebSocket instance that has the same settings
as this instance. |
WebSocket |
WebSocket.recreate(int timeout)
Create a new
WebSocket instance that has the same settings
as this instance. |
WebSocket |
WebSocket.removeExtension(WebSocketExtension extension)
Remove an extension from
Sec-WebSocket-Extension . |
WebSocket |
WebSocket.removeExtensions(String name)
Remove extensions from
Sec-WebSocket-Extension by
an extension name. |
WebSocket |
WebSocket.removeHeaders(String name)
Remove pairs of extra HTTP headers.
|
WebSocket |
WebSocket.removeListener(WebSocketListener listener)
Remove a listener from this WebSocket.
|
WebSocket |
WebSocket.removeListeners(List<WebSocketListener> listeners)
Remove listeners.
|
WebSocket |
WebSocket.removeProtocol(String protocol)
Remove a protocol from
Sec-WebSocket-Protocol . |
WebSocket |
WebSocket.sendBinary(byte[] message)
Send a binary message to the server.
|
WebSocket |
WebSocket.sendBinary(byte[] payload,
boolean fin)
Send a binary frame to the server.
|
WebSocket |
WebSocket.sendClose()
Send a close frame to the server.
|
WebSocket |
WebSocket.sendClose(int closeCode)
Send a close frame to the server.
|
WebSocket |
WebSocket.sendClose(int closeCode,
String reason)
Send a close frame to the server.
|
WebSocket |
WebSocket.sendContinuation()
Send a continuation frame to the server.
|
WebSocket |
WebSocket.sendContinuation(boolean fin)
Send a continuation frame to the server.
|
WebSocket |
WebSocket.sendContinuation(byte[] payload)
Send a continuation frame to the server.
|
WebSocket |
WebSocket.sendContinuation(byte[] payload,
boolean fin)
Send a continuation frame to the server.
|
WebSocket |
WebSocket.sendContinuation(String payload)
Send a continuation frame to the server.
|
WebSocket |
WebSocket.sendContinuation(String payload,
boolean fin)
Send a continuation frame to the server.
|
WebSocket |
WebSocket.sendFrame(WebSocketFrame frame)
Send a WebSocket frame to the server.
|
WebSocket |
WebSocket.sendPing()
Send a ping frame to the server.
|
WebSocket |
WebSocket.sendPing(byte[] payload)
Send a ping frame to the server.
|
WebSocket |
WebSocket.sendPing(String payload)
Send a ping frame to the server.
|
WebSocket |
WebSocket.sendPong()
Send a pong frame to the server.
|
WebSocket |
WebSocket.sendPong(byte[] payload)
Send a pong frame to the server.
|
WebSocket |
WebSocket.sendPong(String payload)
Send a pong frame to the server.
|
WebSocket |
WebSocket.sendText(String message)
Send a text message to the server.
|
WebSocket |
WebSocket.sendText(String payload,
boolean fin)
Send a text frame to the server.
|
WebSocket |
WebSocket.setAutoFlush(boolean auto)
Enable or disable auto-flush of sent frames.
|
WebSocket |
WebSocket.setDirectTextMessage(boolean direct)
Set whether to receive text messages directly as byte arrays without
string conversion.
|
WebSocket |
WebSocket.setExtended(boolean extended)
Allow or disallow extended use of WebSocket frames.
|
WebSocket |
WebSocket.setFrameQueueSize(int size)
Set the size of the frame queue.
|
WebSocket |
WebSocket.setMaxPayloadSize(int size)
Set the maximum payload size.
|
WebSocket |
WebSocket.setMissingCloseFrameAllowed(boolean allowed)
Set whether to allow the server to close the WebSocket connection
without sending a close frame
to this client.
|
WebSocket |
WebSocket.setPingInterval(long interval)
Set the interval of periodical
ping
frames.
|
WebSocket |
WebSocket.setPingPayloadGenerator(PayloadGenerator generator)
Set the generator of payload of ping frames that are sent automatically.
|
WebSocket |
WebSocket.setPingSenderName(String name)
Set the name of the
Timer that sends ping frames periodically. |
WebSocket |
WebSocket.setPongInterval(long interval)
Set the interval of periodical
pong
frames.
|
WebSocket |
WebSocket.setPongPayloadGenerator(PayloadGenerator generator)
Set the generator of payload of pong frames that are sent automatically.
|
WebSocket |
WebSocket.setPongSenderName(String name)
Set the name of the
Timer that sends pong frames periodically. |
WebSocket |
WebSocket.setUserInfo(String userInfo)
Set the credentials to connect to the WebSocket endpoint.
|
WebSocket |
WebSocket.setUserInfo(String id,
String password)
Set the credentials to connect to the WebSocket endpoint.
|
Modifier and Type | Method and Description |
---|---|
Future<WebSocket> |
WebSocket.connect(ExecutorService executorService)
Execute
connect() asynchronously using the given ExecutorService . |
Callable<WebSocket> |
WebSocket.connectable()
|
Modifier and Type | Method and Description |
---|---|
void |
WebSocketAdapter.handleCallbackError(WebSocket websocket,
Throwable cause) |
void |
WebSocketListener.handleCallbackError(WebSocket websocket,
Throwable cause)
Called when an
onXxx() method threw a Throwable . |
void |
WebSocketAdapter.onBinaryFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onBinaryFrame(WebSocket websocket,
WebSocketFrame frame)
Called when a binary frame (opcode = 0x2) was received.
|
void |
WebSocketAdapter.onBinaryMessage(WebSocket websocket,
byte[] binary) |
void |
WebSocketListener.onBinaryMessage(WebSocket websocket,
byte[] binary)
Called when a binary message was received.
|
void |
WebSocketAdapter.onCloseFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onCloseFrame(WebSocket websocket,
WebSocketFrame frame)
Called when a close frame (opcode = 0x8) was received.
|
void |
WebSocketAdapter.onConnected(WebSocket websocket,
Map<String,List<String>> headers) |
void |
WebSocketListener.onConnected(WebSocket websocket,
Map<String,List<String>> headers)
Called after the opening handshake of the WebSocket connection succeeded.
|
void |
WebSocketAdapter.onConnectError(WebSocket websocket,
WebSocketException exception) |
void |
WebSocketListener.onConnectError(WebSocket websocket,
WebSocketException cause)
Called when
connectAsynchronously() failed. |
void |
WebSocketAdapter.onContinuationFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onContinuationFrame(WebSocket websocket,
WebSocketFrame frame)
Called when a continuation frame (opcode = 0x0) was received.
|
void |
WebSocketAdapter.onDisconnected(WebSocket websocket,
WebSocketFrame serverCloseFrame,
WebSocketFrame clientCloseFrame,
boolean closedByServer) |
void |
WebSocketListener.onDisconnected(WebSocket websocket,
WebSocketFrame serverCloseFrame,
WebSocketFrame clientCloseFrame,
boolean closedByServer)
Called after the WebSocket connection was closed.
|
void |
WebSocketAdapter.onError(WebSocket websocket,
WebSocketException cause) |
void |
WebSocketListener.onError(WebSocket websocket,
WebSocketException cause)
Call when an error occurred.
|
void |
WebSocketAdapter.onFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onFrame(WebSocket websocket,
WebSocketFrame frame)
Called when a frame was received.
|
void |
WebSocketAdapter.onFrameError(WebSocket websocket,
WebSocketException cause,
WebSocketFrame frame) |
void |
WebSocketListener.onFrameError(WebSocket websocket,
WebSocketException cause,
WebSocketFrame frame)
Called when a WebSocket frame failed to be read from the WebSocket.
|
void |
WebSocketAdapter.onFrameSent(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onFrameSent(WebSocket websocket,
WebSocketFrame frame)
Called when a WebSocket frame was sent to the server
(but not flushed yet).
|
void |
WebSocketAdapter.onFrameUnsent(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onFrameUnsent(WebSocket websocket,
WebSocketFrame frame)
Called when a WebSocket frame was not sent to the server
because a close frame has already been sent.
|
void |
WebSocketAdapter.onMessageDecompressionError(WebSocket websocket,
WebSocketException cause,
byte[] compressed) |
void |
WebSocketListener.onMessageDecompressionError(WebSocket websocket,
WebSocketException cause,
byte[] compressed)
Called when a message failed to be decompressed.
|
void |
WebSocketAdapter.onMessageError(WebSocket websocket,
WebSocketException cause,
List<WebSocketFrame> frames) |
void |
WebSocketListener.onMessageError(WebSocket websocket,
WebSocketException cause,
List<WebSocketFrame> frames)
Called when it failed to concatenate payloads of multiple frames
to construct a message.
|
void |
WebSocketAdapter.onPingFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onPingFrame(WebSocket websocket,
WebSocketFrame frame)
Called when a ping frame (opcode = 0x9) was received.
|
void |
WebSocketAdapter.onPongFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onPongFrame(WebSocket websocket,
WebSocketFrame frame)
Called when a pong frame (opcode = 0xA) was received.
|
void |
WebSocketAdapter.onSendError(WebSocket websocket,
WebSocketException cause,
WebSocketFrame frame) |
void |
WebSocketListener.onSendError(WebSocket websocket,
WebSocketException cause,
WebSocketFrame frame)
Called when an error occurred when a frame was tried to be sent
to the server.
|
void |
WebSocketAdapter.onSendingFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onSendingFrame(WebSocket websocket,
WebSocketFrame frame)
Called before a WebSocket frame is sent.
|
void |
WebSocketAdapter.onSendingHandshake(WebSocket websocket,
String requestLine,
List<String[]> headers) |
void |
WebSocketListener.onSendingHandshake(WebSocket websocket,
String requestLine,
List<String[]> headers)
Called before an opening handshake is sent to the server.
|
void |
WebSocketAdapter.onStateChanged(WebSocket websocket,
WebSocketState newState) |
void |
WebSocketListener.onStateChanged(WebSocket websocket,
WebSocketState newState)
Called after the state of the WebSocket changed.
|
void |
WebSocketAdapter.onTextFrame(WebSocket websocket,
WebSocketFrame frame) |
void |
WebSocketListener.onTextFrame(WebSocket websocket,
WebSocketFrame frame)
Called when a text frame (opcode = 0x1) was received.
|
void |
WebSocketAdapter.onTextMessage(WebSocket websocket,
byte[] data) |
void |
WebSocketListener.onTextMessage(WebSocket websocket,
byte[] data)
Called when a text message was received instead of
WebSocketListener.onTextMessage(WebSocket, String) when isDirectTextMessage()
returns true . |
void |
WebSocketAdapter.onTextMessage(WebSocket websocket,
String text) |
void |
WebSocketListener.onTextMessage(WebSocket websocket,
String text)
Called when a text message was received.
|
void |
WebSocketAdapter.onTextMessageError(WebSocket websocket,
WebSocketException cause,
byte[] data) |
void |
WebSocketListener.onTextMessageError(WebSocket websocket,
WebSocketException cause,
byte[] data)
Called when it failed to convert payload data into a string.
|
void |
WebSocketAdapter.onThreadCreated(WebSocket websocket,
ThreadType threadType,
Thread thread) |
void |
WebSocketListener.onThreadCreated(WebSocket websocket,
ThreadType threadType,
Thread thread)
Called between after a thread is created and before the thread's
start() method is called. |
void |
WebSocketAdapter.onThreadStarted(WebSocket websocket,
ThreadType threadType,
Thread thread) |
void |
WebSocketListener.onThreadStarted(WebSocket websocket,
ThreadType threadType,
Thread thread)
Called at the very beginning of the thread's
run() method implementation. |
void |
WebSocketAdapter.onThreadStopping(WebSocket websocket,
ThreadType threadType,
Thread thread) |
void |
WebSocketListener.onThreadStopping(WebSocket websocket,
ThreadType threadType,
Thread thread)
Called at the very end of the thread's
run() method implementation. |
void |
WebSocketAdapter.onUnexpectedError(WebSocket websocket,
WebSocketException cause) |
void |
WebSocketListener.onUnexpectedError(WebSocket websocket,
WebSocketException cause)
Called when an uncaught throwable was detected in either the
reading thread (which reads frames from the server) or the
writing thread (which sends frames to the server).
|
Copyright © 2021. All rights reserved.