类 AbstractWebSocketHandler
- java.lang.Object
- org.springframework.web.socket.handler.AbstractWebSocketHandler
- 所有已实现的接口:
WebSocketHandler
public abstract class AbstractWebSocketHandler extends Object implements WebSocketHandler
A convenient base class forWebSocketHandler
implementation with empty methods.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Phillip Webb
构造器概要
构造器 构造器 说明 AbstractWebSocketHandler()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterConnectionClosed(WebSocketSession session, CloseStatus status)
Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred.void
afterConnectionEstablished(WebSocketSession session)
Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.protected void
handleBinaryMessage(WebSocketSession session, BinaryMessage message)
void
handleMessage(WebSocketSession session, WebSocketMessage<?> message)
Invoked when a new WebSocket message arrives.protected void
handlePongMessage(WebSocketSession session, PongMessage message)
protected void
handleTextMessage(WebSocketSession session, TextMessage message)
void
handleTransportError(WebSocketSession session, Throwable exception)
Handle an error from the underlying WebSocket message transport.boolean
supportsPartialMessages()
Whether the WebSocketHandler handles partial messages.
构造器详细资料
AbstractWebSocketHandler
public AbstractWebSocketHandler()
方法详细资料
afterConnectionEstablished
public void afterConnectionEstablished(WebSocketSession session) throws Exception
从接口复制的说明:WebSocketHandler
Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.- 指定者:
afterConnectionEstablished
在接口中WebSocketHandler
- 抛出:
Exception
- this method can handle or propagate exceptions; see class-level Javadoc for details.
handleMessage
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception
从接口复制的说明:WebSocketHandler
Invoked when a new WebSocket message arrives.- 指定者:
handleMessage
在接口中WebSocketHandler
- 抛出:
Exception
- this method can handle or propagate exceptions; see class-level Javadoc for details.
handleTextMessage
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception
- 抛出:
Exception
handleBinaryMessage
protected void handleBinaryMessage(WebSocketSession session, BinaryMessage message) throws Exception
- 抛出:
Exception
handlePongMessage
protected void handlePongMessage(WebSocketSession session, PongMessage message) throws Exception
- 抛出:
Exception
handleTransportError
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception
从接口复制的说明:WebSocketHandler
Handle an error from the underlying WebSocket message transport.- 指定者:
handleTransportError
在接口中WebSocketHandler
- 抛出:
Exception
- this method can handle or propagate exceptions; see class-level Javadoc for details.
afterConnectionClosed
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception
从接口复制的说明:WebSocketHandler
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.- 指定者:
afterConnectionClosed
在接口中WebSocketHandler
- 抛出:
Exception
- this method can handle or propagate exceptions; see class-level Javadoc for details.
supportsPartialMessages
public boolean supportsPartialMessages()
从接口复制的说明:WebSocketHandler
Whether the WebSocketHandler handles partial messages. If this flag is set totrue
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 toWebSocketHandler.handleMessage(WebSocketSession, WebSocketMessage)
. The flagWebSocketMessage.isLast()
indicates if the message is partial and whether it is the last part.- 指定者:
supportsPartialMessages
在接口中WebSocketHandler