package com.cm.central.control.service.socket.pong;

import com.cm.central.control.service.socket.BaseSocketService;
import com.cm.socket.enums.SocketMessageEnum;
import com.cm.socket.enums.SocketTypeMessageEnum;
import com.cm.socket.pojo.Message;
import com.cm.socket.pojo.SocketResult;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.stereotype.Service;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: ClientPongService
 * @Description: 客户端Pong业务
 * @Author: WangGeng
 * @Date: 2020/7/28 2:38 下午
 * @Version: 1.0
 **/
@Service("socketPongServiceImpl")
public class SocketPongServiceImpl extends BaseSocketService {

    @Override
    protected void readMessageService(ChannelHandlerContext channelHandlerContext, Message readMessage) {
        autoReply(channelHandlerContext);
    }

    @Override
    public void autoReply(ChannelHandlerContext channelHandlerContext) {
        writeMessage(channelHandlerContext, SocketTypeMessageEnum.MESSAGE_TYPE_PONG, SocketMessageEnum.MESSAGE_PONG.getMessage());
    }
}
