feat(新增操作handler): * 新增操作ServerOperation类中方法会话建立Handler,已在与客户端会话创建后可进行操作 * 修改错误消息提醒

This commit is contained in:
叁玖领域 2025-09-29 16:55:02 +08:00
parent de25eb9011
commit 8ac6e8a305
8 changed files with 24 additions and 13 deletions

View File

@ -384,10 +384,6 @@ public abstract class AbstractWebSocketClient {
public final void stop() {
stopping();
switch (ClientStatus) {
case WAITING_FOR_INIT -> {
stoppingError("Client is not initialized.");
logger.warn("Not Init. (It shouldn't be happened)");
}
case STARTING -> {
stoppingError("Client is already starting.");
logger.info("Client is starting, please waiting.");
@ -427,7 +423,7 @@ public abstract class AbstractWebSocketClient {
stoppingError("Client is already stopping.");
logger.info("Client is already stopping");
}
case STOPPED -> {
case STOPPED, WAITING_FOR_INIT -> {
stoppingError("Client has been stopped.");
logger.info("Client has stopped");
}

View File

@ -337,10 +337,6 @@ public abstract class AbstractWebSocketServer {
public final void stop() {
stopping();
switch (ServerStatus) {
case WAITING_FOR_INIT -> {
stoppingError("Not Init. (It shouldn't be happened)");
logger.warn("Not Init. (It shouldn't be happened)");
}
case STARTING -> {
stoppingError("Server is starting, please waiting.");
logger.info("Server is starting, please waiting.");

View File

@ -115,7 +115,7 @@ public class ClientDLPBHandlerContextWrapper extends AbstractDgLabPowerBoxHandle
//通过构造开启且如果有目标即连上了APP端则开启Message对象校验只有通过校验才能进读取data()
dataMsg = PowerBoxMessage.getNullMessage().getMessage(json);
//发送对象必须是服务器类型 接收者本客户端为占位对象类型 本客户端对象名字类型相同这里取反只有满足条件才能进入 else读取 data
if(
if (
dataMsg.direction.sender().type != RoleType.T_SERVER
&&
!(

View File

@ -19,6 +19,8 @@ package com.r3944realms.dg_lab.websocket.handler.server;
import com.r3944realms.dg_lab.api.operation.ServerOperation;
import com.r3944realms.dg_lab.api.websocket.message.PowerBoxMessage;
import java.util.UUID;
/**
* The type Default server operation.
*/
@ -93,12 +95,16 @@ public class DefaultServerOperation implements ServerOperation {
//NOOP
}
@Override
public void ServerStoppedHandler() {
//NOOP
}
@Override
public void ClientSessionBuildInHandler(String clientId) {
//NOOP
}
@Override
public void InactiveConnectionRemoveHandler(String clientId) {
//NOOP

View File

@ -78,6 +78,8 @@ public class ServerDLPBHandlerContextWrapper extends AbstractDgLabPowerBoxHandle
Channel().add(session.channel());
Connections().put(clientId, session);
logger.info("新的 webSocket 连接已建立, 标识符为{}", clientId);
String finalClientId = clientId;
TryCatch(n -> ((ServerOperation)operation).ClientSessionBuildInHandler(finalClientId));
}
@Override

View File

@ -19,6 +19,8 @@ package com.r3944realms.dg_lab.api.operation;
import com.r3944realms.dg_lab.api.websocket.message.PowerBoxMessage;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
/**
* The interface Server operation.
*/
@ -56,6 +58,11 @@ public interface ServerOperation extends IOperation {
*/
void ServerStoppedHandler();
/**
* 客户端会话连接触发器
*/
void ClientSessionBuildInHandler(String clientId);
/**
* 在定时器里即将被移除的UUID处理
*

View File

@ -7,7 +7,7 @@ org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
# ROOT
project_name=DgLab
project_version=4.3.11.18
project_version=4.3.12.18
project_group=top.r3944realms.dg_lab
# API

View File

@ -2,10 +2,14 @@
统一用4位版本对于测试性更新统一在其后加-Beta。
修复问题更新为加0.0.0.1,添加/移除新特性加0.0.1.0小部分重构更新加0.1.0.0大量重构加1.0.0.0
2025-09-29-1
project_version=4.3.12.18
* 新增操作ServerOperation类中方法会话建立Handler已在与客户端会话创建后可进行操作
* 修改错误消息提醒
2025-09-23-1
project_version=4.3.11.18
* 添加操作Operation类的Error方法错误的参数同时移除无参方法
*
2025-09-21-4
project_version=4.2.11.18