Instance of this class represents one bi-directional websocket connection.
| Modifier and Type | Class and Description |
|---|---|
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private final EnumSet | |
| private final TyrusEndpointWrapper | |
| private final Lock | |
| private volatile MessageEventListener | |
| private final CountDownLatch | |
| private static final WriterInfo | |
| private static final WriterInfo | |
| private final ProtocolHandler | |
| private final AtomicReference |
| Access | Constructor and Description |
|---|---|
| public | TyrusWebSocket(final ProtocolHandler
used for writing data (sending). protocolHandler, final TyrusEndpointWrapper notifies registered endpoints about incoming events. endpointWrapper)Create new instance, set |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public void | |
| public void | close(int
the closing status code. code, String the reason, if any. reason)Closes this |
| public void | close(CloseReason
the close reason. closeReason)Closes this |
| pack-priv MessageEventListener | |
| pack-priv ProtocolHandler | |
| public boolean | |
| public void | onClose(CloseFrame
the close frame from the remote endpoint. frame)This callback will be invoked when the remote endpoint sent a closing frame. |
| public void | onConnect(UpgradeRequest
request associated with this socket. upgradeRequest, String negotiated subprotocol. subProtocol, List<Extension> negotiated extensions. extensions, String connection id. connectionId, DebugContext debug context. debugContext)This callback will be invoked when the opening handshake between both endpoints has been completed. |
| public void | onFragment(BinaryFrame
the binary data received from the remote endpoint. frame, boolean flag indicating whether or not the payload received is the final fragment of a message. last)This callback will be invoked when a fragmented binary message has been received. |
| public void | onFragment(TextFrame
the text received from the remote endpoint. frame, boolean flag indicating whether or not the payload received is the final fragment of a message. last)This callback will be invoked when a fragmented textual message has been received. |
| public void | onMessage(BinaryFrame
the binary data received from the remote endpoint. frame)This callback will be invoked when a binary message has been received. |
| public void | |
| public void | |
| public void | |
| private Future | |
| public Future | Returns: Future which could be used to control/check the sending completion state.data to be sent. data)
Deprecated
Send a binary frame to the remote endpoint. |
| public Future | Returns: Future which could be used to control/check the sending completion state.data to be sent. data, WriterInfo information about the outbound message. writerInfo)Send a binary frame to the remote endpoint. |
| public void | sendBinary(byte[]
data to be sent. data, SendHandler SendHandler#onResult(jakarta. will be called when sending is complete.
Deprecated
Send a binary frame to the remote endpoint. |
| public void | sendBinary(byte[]
data to be sent. data, SendHandler SendHandler#onResult(jakarta. will be called when sending is complete.information about the outbound message. writerInfo)Send a binary frame to the remote endpoint. |
| public Future | Returns: Future which could be used to control/check the sending completion state.the binary fragment to send. bytes, boolean boolean indicating if this message fragment is the last. last)
Deprecated
Sends a fragment of a complete message. |
| public Future | Returns: Future which could be used to control/check the sending completion state.the binary fragment to send. bytes, boolean boolean indicating if this message fragment is the last. last, WriterInfo information about the outbound message. writerInfo)Sends a fragment of a complete message. |
| public Future | Returns: Future which could be used to control/check the sending completion state.the binary fragment to send. bytes, int the offset within the fragment to send. off, int the number of bytes of the fragment to send. len, boolean boolean indicating if this message fragment is the last. last)
Deprecated
Sends a fragment of a complete message. |
| public Future | Returns: Future which could be used to control/check the sending completion state.the binary fragment to send. bytes, int the offset within the fragment to send. off, int the number of bytes of the fragment to send. len, boolean boolean indicating if this message fragment is the last. last, WriterInfo information about the outbound message. writerInfo)Sends a fragment of a complete message. |
| public Future | |
| public Future | |
| public Future | Returns: Future which could be used to control/check the sending completion state.complete data frame. data)Send a frame to the remote endpoint. |
| public Future | |
| public Future | Returns: Future which could be used to control/check the sending completion state.data to be sent. data, WriterInfo information about the outbound message. writerInfo)Send a text frame to the remote endpoint. |
| public void | sendText(String
data to be sent. data, SendHandler SendHandler#onResult(jakarta. will be called when sending is complete.
Deprecated
Send a text frame to the remote endpoint. |
| public void | sendText(String
data to be sent. data, SendHandler SendHandler#onResult(jakarta. will be called when sending is complete.information about the outbound message. writerInfo)Send a text frame to the remote endpoint. |
| public Future | |
| public Future | Returns: Future which could be used to control/check the sending completion state.the textual fragment to send. fragment, boolean boolean indicating if this message fragment is the last. last, WriterInfo information about the outbound message. writerInfo)Sends a fragment of a complete message. |
| pack-priv void | setMessageEventListener(MessageEventListener
message event listener. messageEventListener)Set message event listener. |
| public void |
| connected | back to summary |
|---|---|
| private final EnumSet<TyrusWebSocket. | |
| endpointWrapper | back to summary |
|---|---|
| private final TyrusEndpointWrapper endpointWrapper | |
| lock | back to summary |
|---|---|
| private final Lock lock | |
| messageEventListener | back to summary |
|---|---|
| private volatile MessageEventListener messageEventListener | |
| onConnectLatch | back to summary |
|---|---|
| private final CountDownLatch onConnectLatch | |
| PING_INFO | back to summary |
|---|---|
| private static final WriterInfo PING_INFO | |
| PONG_INFO | back to summary |
|---|---|
| private static final WriterInfo PONG_INFO | |
| protocolHandler | back to summary |
|---|---|
| private final ProtocolHandler protocolHandler | |
| state | back to summary |
|---|---|
| private final AtomicReference<TyrusWebSocket. | |
| TyrusWebSocket | back to summary |
|---|---|
| public TyrusWebSocket(final ProtocolHandler protocolHandler, final TyrusEndpointWrapper endpointWrapper) Create new instance, set
| |
| awaitOnConnect | back to summary |
|---|---|
| private void awaitOnConnect() | |
| checkConnectedState | back to summary |
|---|---|
| private void checkConnectedState() | |
| close | back to summary |
|---|---|
| public void close() Closes this | |
| close | back to summary |
|---|---|
| public void close(int code, String reason) Closes this
| |
| close | back to summary |
|---|---|
| public void close(CloseReason closeReason) Closes this
| |
| getMessageEventListener | back to summary |
|---|---|
| pack-priv MessageEventListener getMessageEventListener() Get message event listener.
| |
| getProtocolHandler | back to summary |
|---|---|
| pack-priv ProtocolHandler getProtocolHandler() | |
| isConnected | back to summary |
|---|---|
| public boolean isConnected() Convenience method to determine if this
| |
| onClose | back to summary |
|---|---|
| public void onClose(CloseFrame frame) This callback will be invoked when the remote endpoint sent a closing frame.
The execution of this method is synchronized using
| |
| onConnect | back to summary |
|---|---|
| public void onConnect(UpgradeRequest upgradeRequest, String subProtocol, List<Extension> extensions, String connectionId, DebugContext debugContext) This callback will be invoked when the opening handshake between both endpoints has been completed.
| |
| onFragment | back to summary |
|---|---|
| public void onFragment(BinaryFrame frame, boolean last) This callback will be invoked when a fragmented binary message has been received.
| |
| onFragment | back to summary |
|---|---|
| public void onFragment(TextFrame frame, boolean last) This callback will be invoked when a fragmented textual message has been received.
| |
| onMessage | back to summary |
|---|---|
| public void onMessage(BinaryFrame frame) This callback will be invoked when a binary message has been received.
| |
| onMessage | back to summary |
|---|---|
| public void onMessage(TextFrame frame) This callback will be invoked when a text message has been received.
| |
| onPing | back to summary |
|---|---|
| public void onPing(PingFrame frame) This callback will be invoked when the remote endpoint has sent a ping frame.
| |
| onPong | back to summary |
|---|---|
| public void onPong(PongFrame frame) This callback will be invoked when the remote endpoint has sent a pong frame.
| |
| send | back to summary |
|---|---|
| private Future | |
| sendBinary | back to summary |
|---|---|
| public Future Deprecated
Send a binary frame to the remote endpoint. | |
| sendBinary | back to summary |
|---|---|
| public Future Send a binary frame to the remote endpoint.
| |
| sendBinary | back to summary |
|---|---|
| public void sendBinary(byte[] data, SendHandler handler)
Deprecated
Send a binary frame to the remote endpoint.
| |
| sendBinary | back to summary |
|---|---|
| public void sendBinary(byte[] data, SendHandler handler, WriterInfo writerInfo) Send a binary frame to the remote endpoint.
| |
| sendBinary | back to summary |
|---|---|
| public Future Deprecated
Sends a fragment of a complete message. | |
| sendBinary | back to summary |
|---|---|
| public Future Sends a fragment of a complete message.
| |
| sendBinary | back to summary |
|---|---|
| public Future Deprecated
Sends a fragment of a complete message.
| |
| sendBinary | back to summary |
|---|---|
| public Future Sends a fragment of a complete message.
| |
| sendPing | back to summary |
|---|---|
| public Future Sends a | |
| sendPong | back to summary |
|---|---|
| public Future Sends a It may seem odd to send a pong frame, however, RFC-6455 states: "A Pong frame MAY be sent unsolicited. This serves as a unidirectional heartbeat. A response to an unsolicited Pong frame is not expected." | |
| sendRawFrame | back to summary |
|---|---|
| public Future Send a frame to the remote endpoint.
| |
| sendText | back to summary |
|---|---|
| public Future Deprecated
Send a text frame to the remote endpoint. | |
| sendText | back to summary |
|---|---|
| public Future Send a text frame to the remote endpoint.
| |
| sendText | back to summary |
|---|---|
| public void sendText(String data, SendHandler handler)
Deprecated
Send a text frame to the remote endpoint.
| |
| sendText | back to summary |
|---|---|
| public void sendText(String data, SendHandler handler, WriterInfo writerInfo) Send a text frame to the remote endpoint.
| |
| sendText | back to summary |
|---|---|
| public Future Deprecated
Sends a fragment of a complete message. | |
| sendText | back to summary |
|---|---|
| public Future Sends a fragment of a complete message.
| |
| setMessageEventListener | back to summary |
|---|---|
| pack-priv void setMessageEventListener(MessageEventListener messageEventListener) Set message event listener.
| |
| setWriteTimeout | back to summary |
|---|---|
| public void setWriteTimeout(long timeoutMs) Sets the timeout for the writing operation.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final TyrusWebSocket. | |
| public static final TyrusWebSocket. | |
| public static final TyrusWebSocket. | |
| public static final TyrusWebSocket. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static TyrusWebSocket. | |
| public static TyrusWebSocket. |
| CLOSED | back to summary |
|---|---|
| public static final TyrusWebSocket. | |
| CLOSING | back to summary |
|---|---|
| public static final TyrusWebSocket. | |
| CONNECTED | back to summary |
|---|---|
| public static final TyrusWebSocket. | |
| NEW | back to summary |
|---|---|
| public static final TyrusWebSocket. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static TyrusWebSocket. | |
| values | back to summary |
|---|---|
| public static TyrusWebSocket. | |