WebSocketClient
including SockJsClient.
| Modifier and Type | Class and Description |
|---|---|
| private static class | WebSocketStompClient.
Encode and decode STOMP WebSocket messages. |
| private class | WebSocketStompClient.
Adapt WebSocket to the TcpConnectionHandler and TcpConnection contracts. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private int | |
| private static final Log | |
| private int | |
| private volatile boolean | |
| private final WebSocketClient |
| Access | Constructor and Description |
|---|---|
| public | WebSocketStompClient(WebSocketClient
the WebSocket client to connect with webSocketClient)Class constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public ListenableFuture | Returns: aListenableFuture for access to the session when ready for usethe url to connect to url, StompSessionHandler the session handler handler, Object... the URI variables to expand into the URL uriVars)
Deprecated
since 6.0. as of 6.0, in favor of
connectAsync(String, StompSessionHandler, Object.
Connect to the given WebSocket URL and notify the given
|
| public ListenableFuture | Returns: aListenableFuture for access to the session when ready for usethe url to connect to url, WebSocketHttpHeaders the headers for the WebSocket handshake handshakeHeaders, StompSessionHandler the session handler handler, Object... the URI variables to expand into the URL uriVariables)
Deprecated
since 6.0. as of 6.0, in favor of
connectAsync(String, WebSocketHttpHeaders, StompSessionHandler, Object.
An overloaded version of
|
| public ListenableFuture | Returns: aListenableFuture for access to the session when ready for usethe url to connect to url, WebSocketHttpHeaders headers for the WebSocket handshake handshakeHeaders, StompHeaders headers for the STOMP CONNECT frame connectHeaders, StompSessionHandler the session handler handler, Object... the URI variables to expand into the URL uriVariables)
Deprecated
since 6.0. as of 6.0, in favor of
connectAsync(String, WebSocketHttpHeaders, StompHeaders, StompSessionHandler, Object.
An overloaded version of
|
| public ListenableFuture | Returns: aListenableFuture for access to the session when ready for usethe url to connect to url, WebSocketHttpHeaders the headers for the WebSocket handshake handshakeHeaders, StompHeaders headers for the STOMP CONNECT frame connectHeaders, StompSessionHandler the STOMP session handler sessionHandler)
Deprecated
since 6.0. as of 6.0, in favor of
connectAsync(URI, WebSocketHttpHeaders, StompHeaders, StompSessionHandler)
An overloaded version of
|
| public CompletableFuture | Returns: a CompletableFuture for access to the session when ready for usethe url to connect to url, StompSessionHandler the session handler handler, Object... the URI variables to expand into the URL uriVars)Connect to the given WebSocket URL and notify the given
|
| public CompletableFuture | Returns: aListenableFuture for access to the session when ready for usethe url to connect to url, WebSocketHttpHeaders the headers for the WebSocket handshake handshakeHeaders, StompSessionHandler the session handler handler, Object... the URI variables to expand into the URL uriVariables)An overloaded version of
|
| public CompletableFuture | Returns: a CompletableFuture for access to the session when ready for usethe url to connect to url, WebSocketHttpHeaders headers for the WebSocket handshake handshakeHeaders, StompHeaders headers for the STOMP CONNECT frame connectHeaders, StompSessionHandler the session handler handler, Object... the URI variables to expand into the URL uriVariables)An overloaded version of
|
| public CompletableFuture | Returns: a CompletableFuture for access to the session when ready for usethe url to connect to url, WebSocketHttpHeaders the headers for the WebSocket handshake handshakeHeaders, StompHeaders headers for the STOMP CONNECT frame connectHeaders, StompSessionHandler the STOMP session handler sessionHandler)An overloaded version of
|
| public int | |
| public int | getPhase()
Overrides default org. Return the configured phase. |
| public WebSocketClient | |
| public boolean | isAutoStartup()
Overrides default org. Return the value for the 'autoStartup' property. |
| public boolean | isRunning()
Implements org. Check whether this component is currently running. |
| protected StompHeaders | processConnectHeaders(StompHeaders
the headers to modify connectHeaders)Overrides org. Further initialize the StompHeaders, for example setting the heart-beat header if necessary. |
| public void | setAutoStartup(boolean autoStartup)
Set whether to auto-start the contained WebSocketClient when the Spring context has been refreshed. |
| public void | setInboundMessageSizeLimit(int inboundMessageSizeLimit)
Configure the maximum size allowed for inbound STOMP message. |
| public void | setPhase(int phase)
Specify the phase in which the WebSocket client should be started and subsequently closed. |
| public void | setTaskScheduler(TaskScheduler taskScheduler)
Overrides org. Configure a scheduler to use for heartbeats and for receipt tracking. |
| public void | |
| public void | stop()
Implements org. Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. |
| autoStartup | back to summary |
|---|---|
| private boolean autoStartup | |
| inboundMessageSizeLimit | back to summary |
|---|---|
| private int inboundMessageSizeLimit | |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| phase | back to summary |
|---|---|
| private int phase | |
| running | back to summary |
|---|---|
| private volatile boolean running | |
| webSocketClient | back to summary |
|---|---|
| private final WebSocketClient webSocketClient | |
| WebSocketStompClient | back to summary |
|---|---|
| public WebSocketStompClient(WebSocketClient webSocketClient) Class constructor. Sets
| |
| connect | back to summary |
|---|---|
| public ListenableFuture Connect to the given WebSocket URL and notify the given
| |
| connect | back to summary |
|---|---|
| public ListenableFuture Deprecated since 6.0. as of 6.0, in favor of An overloaded version of
| |
| connect | back to summary |
|---|---|
| public ListenableFuture Deprecated since 6.0. as of 6.0, in favor of An overloaded version of
| |
| connect | back to summary |
|---|---|
| public ListenableFuture Deprecated since 6.0. as of 6.0, in favor of An overloaded version of
| |
| connectAsync | back to summary |
|---|---|
| public CompletableFuture Connect to the given WebSocket URL and notify the given
| |
| connectAsync | back to summary |
|---|---|
| public CompletableFuture An overloaded version of
| |
| connectAsync | back to summary |
|---|---|
| public CompletableFuture An overloaded version of
| |
| connectAsync | back to summary |
|---|---|
| public CompletableFuture An overloaded version of
| |
| getInboundMessageSizeLimit | back to summary |
|---|---|
| public int getInboundMessageSizeLimit() Get the configured inbound message buffer size in bytes. | |
| getPhase | back to summary |
|---|---|
| public int getPhase() Overrides default org. Return the configured phase.
| |
| getWebSocketClient | back to summary |
|---|---|
| public WebSocketClient getWebSocketClient() Return the configured WebSocketClient. | |
| isAutoStartup | back to summary |
|---|---|
| public boolean isAutoStartup() Overrides default org. Return the value for the 'autoStartup' property. If "true", this client will automatically start and stop the contained WebSocketClient.
| |
| isRunning | back to summary |
|---|---|
| public boolean isRunning() Implements org. Doc from org. Check whether this component is currently running. In the case of a container, this will return
| |
| processConnectHeaders | back to summary |
|---|---|
| protected StompHeaders processConnectHeaders(StompHeaders connectHeaders) Overrides org. Doc from org. Further initialize the StompHeaders, for example setting the heart-beat header if necessary.
| |
| setAutoStartup | back to summary |
|---|---|
| public void setAutoStartup(boolean autoStartup) Set whether to auto-start the contained WebSocketClient when the Spring context has been refreshed. Default is "true". | |
| setInboundMessageSizeLimit | back to summary |
|---|---|
| public void setInboundMessageSizeLimit(int inboundMessageSizeLimit) Configure the maximum size allowed for inbound STOMP message. Since a STOMP message can be received in multiple WebSocket messages, buffering may be required and this property determines the maximum buffer size per message. By default this is set to 64 * 1024 (64K). | |
| setPhase | back to summary |
|---|---|
| public void setPhase(int phase) Specify the phase in which the WebSocket client should be started and subsequently closed. The startup order proceeds from lowest to highest, and the shutdown order is the reverse of that. By default this is Integer.MAX_VALUE meaning that the WebSocket client is started as late as possible and stopped as soon as possible. | |
| setTaskScheduler | back to summary |
|---|---|
| public void setTaskScheduler(TaskScheduler taskScheduler) Overrides org. Doc from org. Configure a scheduler to use for heartbeats and for receipt tracking. Note Some transports have built-in support to work with heartbeats and therefore do not require a TaskScheduler. Receipts however, if needed, do require a TaskScheduler to be configured. By default, this is not set. Also automatically sets the
| |
| start | back to summary |
|---|---|
| public void start() Implements org. Doc from org. Start this component. Should not throw an exception if the component is already running. In the case of a container, this will propagate the start signal to all components that apply.
| |
| stop | back to summary |
|---|---|
| public void stop() Implements org. Doc from org. Stop this component, typically in a synchronous fashion, such that the component is
fully stopped upon return of this method. Consider implementing Note that this stop notification is not guaranteed to come before destruction:
On regular shutdown, Should not throw an exception if the component is not running (not started yet). In the case of a container, this will propagate the stop signal to all components that apply.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final BufferingStompDecoder | |
| private static final StompDecoder | |
| private static final StompEncoder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public List | |
| public WebSocketMessage |
| bufferingDecoder | back to summary |
|---|---|
| private final BufferingStompDecoder bufferingDecoder | |
| DECODER | back to summary |
|---|---|
| private static final StompDecoder DECODER | |
| ENCODER | back to summary |
|---|---|
| private static final StompEncoder ENCODER | |
| StompWebSocketMessageCodec | back to summary |
|---|---|
| public StompWebSocketMessageCodec(int messageSizeLimit) | |
| decode | back to summary |
|---|---|
| public List | |
| encode | back to summary |
|---|---|
| public WebSocketMessage | |
| Modifier and Type | Field and Description |
|---|---|
| private final WebSocketStompClient. | |
| private volatile long | |
| private volatile long | |
| private ScheduledFuture | |
| private volatile WebSocketSession | |
| private final TcpConnectionHandler | |
| private ScheduledFuture |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(WebSocketSession
the first input argument webSocketSession, Throwable the second input argument throwable)Implements java. Performs this operation on the given arguments. |
| public void | afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)
Implements org. Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred. |
| public void | afterConnectionEstablished(WebSocketSession session)
Implements org. Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use. |
| private static void | |
| private void | |
| public void | |
| public void | handleMessage(WebSocketSession session, WebSocketMessage<?> webSocketMessage)
Implements org. Invoked when a new WebSocket message arrives. |
| public void | handleTransportError(WebSocketSession session, Throwable ex)
Implements org. Handle an error from the underlying WebSocket message transport. |
| public void | onReadInactivity(final Runnable
the task to invoke runnable, final long the amount of inactive time in milliseconds duration)Implements org. Register a task to invoke after a period of read inactivity. |
| public void | onWriteInactivity(final Runnable
the task to invoke runnable, final long the amount of inactive time in milliseconds duration)Implements org. Register a task to invoke after a period of write inactivity. |
| public CompletableFuture | sendAsync(Message<byte[]>
the message message)Implements org. Send the given message. |
| public boolean | supportsPartialMessages()
Implements org. Whether the WebSocketHandler handles partial messages. |
| private void |
| codec | back to summary |
|---|---|
| private final WebSocketStompClient. | |
| lastReadTime | back to summary |
|---|---|
| private volatile long lastReadTime | |
| lastWriteTime | back to summary |
|---|---|
| private volatile long lastWriteTime | |
| readInactivityFuture | back to summary |
|---|---|
| private ScheduledFuture<?> readInactivityFuture
| |
| session | back to summary |
|---|---|
| private volatile WebSocketSession session
| |
| stompSession | back to summary |
|---|---|
| private final TcpConnectionHandler<byte[]> stompSession | |
| writeInactivityFuture | back to summary |
|---|---|
| private ScheduledFuture<?> writeInactivityFuture
| |
| WebSocketTcpConnectionHandlerAdapter | back to summary |
|---|---|
| public WebSocketTcpConnectionHandlerAdapter(TcpConnectionHandler<byte[]> stompSession) | |
| accept | back to summary |
|---|---|
| public void accept(WebSocketSession webSocketSession, Throwable throwable) Implements java. Doc from java. Performs this operation on the given arguments.
| |
| afterConnectionClosed | back to summary |
|---|---|
| public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) Implements org. Doc from org. Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred. Although the session may technically still be open, depending on the underlying implementation, sending messages at this point is discouraged and most likely will not succeed.
| |
| afterConnectionEstablished | back to summary |
|---|---|
| public void afterConnectionEstablished(WebSocketSession session) Implements org. Doc from org. Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.
| |
| cancelFuture | back to summary |
|---|---|
| private static void cancelFuture(ScheduledFuture<?> future) | |
| cancelInactivityTasks | back to summary |
|---|---|
| private void cancelInactivityTasks() | |
| close | back to summary |
|---|---|
| public void close() Implements org. Doc from org. Close the connection.
| |
| handleMessage | back to summary |
|---|---|
| public void handleMessage(WebSocketSession session, WebSocketMessage<?> webSocketMessage) Implements org. Doc from org. Invoked when a new WebSocket message arrives.
| |
| handleTransportError | back to summary |
|---|---|
| public void handleTransportError(WebSocketSession session, Throwable ex) Implements org. Doc from org. Handle an error from the underlying WebSocket message transport.
| |
| onReadInactivity | back to summary |
|---|---|
| public void onReadInactivity(final Runnable runnable, final long duration) Implements org. Doc from org. Register a task to invoke after a period of read inactivity. | |
| onWriteInactivity | back to summary |
|---|---|
| public void onWriteInactivity(final Runnable runnable, final long duration) Implements org. Doc from org. Register a task to invoke after a period of write inactivity. | |
| sendAsync | back to summary |
|---|---|
| public CompletableFuture Implements org. Doc from org. Send the given message.
| |
| supportsPartialMessages | back to summary |
|---|---|
| public boolean supportsPartialMessages() Implements org. Doc from org. Whether the WebSocketHandler handles partial messages. If this flag is set to
| |
| updateLastWriteTime | back to summary |
|---|---|
| private void updateLastWriteTime() | |