实时通讯

This commit is contained in:
2025-12-01 15:41:37 +08:00
parent e6623be1e5
commit 7fb4bf94c4
3 changed files with 27 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
package com.realtime.packets.server.handler;
import com.realtime.packets.AutoSoftwarePacket;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@ChannelHandler.Sharable
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AutoSoftwareHandler extends SimpleChannelInboundHandler<AutoSoftwarePacket> {
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, AutoSoftwarePacket connectPacket) throws Exception {
String url = connectPacket.getUrl();
}
}

View File

@@ -19,6 +19,7 @@ import java.util.List;
public class PacketServiceImpl implements PacketService {
private final List<PackStrategy> packStrategies;
@Override
public BasePackets getCurrent(JSONObject jsonObject) {
Byte command = jsonObject.getByte("command");

View File

@@ -19,6 +19,6 @@ public class PingPongPackStrategyImpl implements PackStrategy {
@Override
public BasePackets getCurrentPacket(JSONObject jsonObject) {
return JSONObject.parseObject(jsonObject.toString(), PingPongPacket.class);
return JSONObject.parseObject(jsonObject.toString(), PingPongPacket.class);
}
}