feat: 添加 WebSocket 基础设施
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.webgame.webgamebackend.ws;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
import org.springframework.web.socket.TextMessage;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
import org.springframework.web.socket.handler.TextWebSocketHandler;
|
||||
|
||||
/**
|
||||
* 房间 WebSocket 处理器
|
||||
*
|
||||
* 管理游戏房间内的实时通信,包括玩家加入、离开、游戏状态同步等。
|
||||
* 后续任务将实现具体业务逻辑。
|
||||
*/
|
||||
@Component
|
||||
public class RoomWebSocketHandler extends TextWebSocketHandler {
|
||||
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
|
||||
// 后续任务实现
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
|
||||
// 后续任务实现
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
|
||||
// 后续任务实现
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user