feat(新增操作handler): * 新增操作ServerOperation类中方法会话建立Handler,已在与客户端会话创建后可进行操作 * 修改错误消息提醒
This commit is contained in:
parent
de25eb9011
commit
8ac6e8a305
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
&&
|
||||
!(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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处理
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user