实时通讯
This commit is contained in:
@@ -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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import java.util.List;
|
|||||||
public class PacketServiceImpl implements PacketService {
|
public class PacketServiceImpl implements PacketService {
|
||||||
|
|
||||||
private final List<PackStrategy> packStrategies;
|
private final List<PackStrategy> packStrategies;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BasePackets getCurrent(JSONObject jsonObject) {
|
public BasePackets getCurrent(JSONObject jsonObject) {
|
||||||
Byte command = jsonObject.getByte("command");
|
Byte command = jsonObject.getByte("command");
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ public class PingPongPackStrategyImpl implements PackStrategy {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BasePackets getCurrentPacket(JSONObject jsonObject) {
|
public BasePackets getCurrentPacket(JSONObject jsonObject) {
|
||||||
return JSONObject.parseObject(jsonObject.toString(), PingPongPacket.class);
|
return JSONObject.parseObject(jsonObject.toString(), PingPongPacket.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user