|
...
|
...
|
@@ -77,24 +77,24 @@ public class CIMServer { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 发送 Google Protocol 编码消息
|
|
|
|
* @param sendMsgReqVO 消息
|
|
|
|
*/
|
|
|
|
public void sendMsg(SendMsgReqVO sendMsgReqVO){
|
|
|
|
NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId());
|
|
|
|
|
|
|
|
if (null == socketChannel) {
|
|
|
|
LOGGER.error("client {} offline!", sendMsgReqVO.getUserId());
|
|
|
|
/**
|
|
|
|
* 发送 Google Protocol 编码消息
|
|
|
|
* @param sendMsgReqVO 消息
|
|
|
|
*/
|
|
|
|
public void sendMsg(SendMsgReqVO sendMsgReqVO){
|
|
|
|
NioSocketChannel socketChannel = SessionSocketHolder.get(sendMsgReqVO.getUserId());
|
|
|
|
|
|
|
|
if (null == socketChannel) {
|
|
|
|
LOGGER.error("client {} offline!", sendMsgReqVO.getUserId());
|
|
|
|
}
|
|
|
|
CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder()
|
|
|
|
.setRequestId(sendMsgReqVO.getUserId())
|
|
|
|
.setReqMsg(sendMsgReqVO.getMsg())
|
|
|
|
.setType(Constants.CommandType.MSG)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
ChannelFuture future = socketChannel.writeAndFlush(protocol);
|
|
|
|
future.addListener((ChannelFutureListener) channelFuture ->
|
|
|
|
LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString()));
|
|
|
|
}
|
|
|
|
CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder()
|
|
|
|
.setRequestId(sendMsgReqVO.getUserId())
|
|
|
|
.setReqMsg(sendMsgReqVO.getMsg())
|
|
|
|
.setType(Constants.CommandType.MSG)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
ChannelFuture future = socketChannel.writeAndFlush(protocol);
|
|
|
|
future.addListener((ChannelFutureListener) channelFuture ->
|
|
|
|
LOGGER.info("server push msg:[{}]", sendMsgReqVO.toString()));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|