WebSocketHandler that adds SockJS messages frames, sends
SockJS heartbeat messages, and delegates lifecycle events and messages to a target
WebSocketHandler.
Methods in this class allow exceptions from the wrapped WebSocketHandler to
propagate. However, any exceptions resulting from SockJS message handling (e.g. while
sending SockJS frames or heartbeat messages) are caught and treated as transport
errors, i.e. routed to the
handleTransportError method of the wrapped handler and the session closed.
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicInteger | |
| private final SockJsServiceConfig | |
| private final WebSocketServerSockJsSession | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public | SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler, WebSocketServerSockJsSession sockJsSession)
|
| sessionCount | back to summary |
|---|---|
| private final AtomicInteger sessionCount | |
| sockJsServiceConfig | back to summary |
|---|---|
| private final SockJsServiceConfig sockJsServiceConfig | |
| sockJsSession | back to summary |
|---|---|
| private final WebSocketServerSockJsSession sockJsSession | |
| subProtocols | back to summary |
|---|---|
| private final List<String> subProtocols | |
| SockJsWebSocketHandler | back to summary |
|---|---|
| public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler, WebSocketServerSockJsSession sockJsSession) | |
| afterConnectionClosed | back to summary |
|---|---|
| public void afterConnectionClosed(WebSocketSession wsSession, CloseStatus status) throws Exception Overrides org. 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 wsSession) throws Exception Overrides org. Implements org. Doc from org. Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use. | |
| getSockJsConfig | back to summary |
|---|---|
| protected SockJsServiceConfig getSockJsConfig() | |
| getSubProtocols | back to summary |
|---|---|
| public List Implements org. Doc from org. Return the list of supported sub-protocols.
| |
| handleTextMessage | back to summary |
|---|---|
| public void handleTextMessage(WebSocketSession wsSession, TextMessage message) throws Exception Overrides org.
| |
| handleTransportError | back to summary |
|---|---|
| public void handleTransportError(WebSocketSession webSocketSession, Throwable exception) throws Exception Overrides org. Implements org. Doc from org. Handle an error from the underlying WebSocket message transport. | |