public interface WebSocket
| Modifier and Type | Interface and Description |
|---|---|
static interface |
WebSocket.Builder |
static interface |
WebSocket.Listener
Callback methods for websocket events.
|
| Modifier and Type | Method and Description |
|---|---|
long |
queueSize()
Returns the size in bytes of all messages enqueued to be transmitted to the server.
|
void |
request()
Used to receive more onMessage or
WebSocket.Listener.onClose(WebSocket, int, String) events after the initial message is
received |
boolean |
send(ByteBuffer buffer)
Send some data
|
boolean |
sendClose(int code,
String reason)
Send a close message.
|
static URI |
toWebSocketUri(URI httpUri)
Converts http or https URIs to ws or wss URIs.
|
boolean send(ByteBuffer buffer)
boolean sendClose(int code,
String reason)
long queueSize()
void request()
WebSocket.Listener.onClose(WebSocket, int, String) events after the initial message is
received
request is implicitly called by WebSocket.Listener.onOpen(WebSocket)
depending on the websocket implementation request may trigger immediate / concurrent delivery of the close event - this means you'll generally want to call this method once you've completed the consumption of the current event.
static URI toWebSocketUri(URI httpUri)
Clients such as JDK or Jetty require URIs to be performed to the ws protocol, other clients perform this same transformation automatically.
httpUri - the original URI to transform.Copyright © 2015–2023 Red Hat. All rights reserved.