Top Description Constructors Methods
org.springframework.web.socket.handler

public abstract Class AbstractWebSocketHandler

extends Object
implements WebSocketHandler
Class Inheritance
All Implemented Interfaces
org.springframework.web.socket.WebSocketHandler
Known Direct Subclasses
org.springframework.web.socket.handler.BinaryWebSocketHandler, org.springframework.web.socket.handler.TextWebSocketHandler
Imports
org.springframework.web.socket.BinaryMessage, .CloseStatus, .PongMessage, .TextMessage, .WebSocketHandler, .WebSocketMessage, .WebSocketSession

A convenient base class for WebSocketHandler implementation with empty methods.
Authors
Rossen Stoyanchev, Phillip Webb
Since
4.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterConnectionClosed(WebSocketSession session, CloseStatus status)

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

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.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.

protected void
public void
handleMessage(WebSocketSession session, WebSocketMessage<?> message)

Implements org.springframework.web.socket.WebSocketHandler.handleMessage.

Invoked when a new WebSocket message arrives.

protected void
protected void
public void
handleTransportError(WebSocketSession session, Throwable exception)

Implements org.springframework.web.socket.WebSocketHandler.handleTransportError.

Handle an error from the underlying WebSocket message transport.

public boolean
supportsPartialMessages()

Implements org.springframework.web.socket.WebSocketHandler.supportsPartialMessages.

Whether the WebSocketHandler handles partial messages.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractWebSocketHandlerback to summary
public AbstractWebSocketHandler()

Method Detail

afterConnectionClosedback to summary
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

Doc from org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

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.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
afterConnectionEstablishedback to summary
public void afterConnectionEstablished(WebSocketSession session) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Doc from org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
handleBinaryMessageback to summary
protected void handleBinaryMessage(WebSocketSession session, BinaryMessage message) throws Exception
handleMessageback to summary
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.handleMessage.

Doc from org.springframework.web.socket.WebSocketHandler.handleMessage.

Invoked when a new WebSocket message arrives.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
handlePongMessageback to summary
protected void handlePongMessage(WebSocketSession session, PongMessage message) throws Exception
handleTextMessageback to summary
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception
handleTransportErrorback to summary
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.handleTransportError.

Doc from org.springframework.web.socket.WebSocketHandler.handleTransportError.

Handle an error from the underlying WebSocket message transport.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
supportsPartialMessagesback to summary
public boolean supportsPartialMessages()

Implements org.springframework.web.socket.WebSocketHandler.supportsPartialMessages.

Doc from org.springframework.web.socket.WebSocketHandler.supportsPartialMessages.

Whether the WebSocketHandler handles partial messages. If this flag is set to true and the underlying WebSocket server supports partial messages, then a large WebSocket message, or one of an unknown size may be split and maybe received over multiple calls to handleMessage(WebSocketSession, WebSocketMessage). The flag org.springframework.web.socket.WebSocketMessage#isLast() indicates if the message is partial and whether it is the last part.

Annotations
@Override