public abstract class BaseHandler
extends org.springframework.web.socket.handler.TextWebSocketHandler
Constructor and Description |
---|
BaseHandler() |
Modifier and Type | Method and Description |
---|---|
void |
afterConnectionClosed(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.CloseStatus status) |
void |
afterConnectionEstablished(org.springframework.web.socket.WebSocketSession session) |
protected void |
afterConnectionEstablishedImpl(org.springframework.web.socket.WebSocketSession session)
建立会话后
|
abstract void |
destroy(org.springframework.web.socket.WebSocketSession session)
关闭连接
|
void |
handleTransportError(org.springframework.web.socket.WebSocketSession session,
Throwable exception) |
protected void |
logOpt(Class<?> cls,
Map<String,Object> attributes,
Object reqData)
操作 websocket 日志
|
protected void |
sendMsg(org.springframework.web.socket.WebSocketSession session,
String msg) |
protected void |
showHelloMsg(Map<String,Object> attributes,
org.springframework.web.socket.WebSocketSession session) |
handleBinaryMessage
public void afterConnectionEstablished(org.springframework.web.socket.WebSocketSession session) throws Exception
afterConnectionEstablished
in interface org.springframework.web.socket.WebSocketHandler
afterConnectionEstablished
in class org.springframework.web.socket.handler.AbstractWebSocketHandler
Exception
protected void showHelloMsg(Map<String,Object> attributes, org.springframework.web.socket.WebSocketSession session)
protected void afterConnectionEstablishedImpl(org.springframework.web.socket.WebSocketSession session) throws Exception
session
- 会话Exception
- 异常public void handleTransportError(org.springframework.web.socket.WebSocketSession session, Throwable exception)
handleTransportError
in interface org.springframework.web.socket.WebSocketHandler
handleTransportError
in class org.springframework.web.socket.handler.AbstractWebSocketHandler
public void afterConnectionClosed(org.springframework.web.socket.WebSocketSession session, org.springframework.web.socket.CloseStatus status)
afterConnectionClosed
in interface org.springframework.web.socket.WebSocketHandler
afterConnectionClosed
in class org.springframework.web.socket.handler.AbstractWebSocketHandler
public abstract void destroy(org.springframework.web.socket.WebSocketSession session)
session
- sessionprotected void sendMsg(org.springframework.web.socket.WebSocketSession session, String msg)
Copyright © 2017–2022. All rights reserved.