use of io.transport.core.protocol.message.internal.DeviceRegistRespMessage in project transporter by wang4ever.
the class TransportMessageHandler method processDeviceRegisted.
/**
* 注册前端设备连接认证信息处理
*
* @param ctx
* @param msg
*/
private void processDeviceRegisted(ChannelHandlerContext ctx, DeviceRegistMessage msg) {
// 1.1 Check deviceId.
for (Object deviceId : msg.getClientDeviceIds()) {
if (ByteBufs.toBytes(String.valueOf(deviceId)).length != DeviceInfo.ID_LEN)
throw new TransportException("Protocol error, parameter 'deviceId' length can only be " + DeviceInfo.ID_LEN);
}
// 1.2 保存注册前端设备连接认证信息Redis
for (Object deviceId : msg.getClientDeviceIds()) this.jedisService.set(String.valueOf(deviceId), msg.getAppId(), msg.getExpired());
if (logger.isInfoEnabled())
logger.info("新注册认证设备: msg={}", JSON.toJSONString(msg));
// 1.3 Echo客户端
DeviceRegistRespMessage resp = new DeviceRegistRespMessage();
this.echoWrite(ctx, resp);
if (logger.isDebugEnabled())
logger.debug("Echo message. {}", resp);
}
Aggregations