Java Code Examples for com.akaxin.proto.core.CoreProto#TransportPackageData
The following examples show how to use
com.akaxin.proto.core.CoreProto#TransportPackageData .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlatformClientHandler.java From openzaly with Apache License 2.0 | 6 votes |
@Override protected void channelRead0(ChannelHandlerContext ctx, RedisCommand redisCmd) throws Exception { String version = redisCmd.getParameterByIndex(0); String action = redisCmd.getParameterByIndex(1); byte[] params = redisCmd.getBytesParamByIndex(2); CoreProto.TransportPackageData packageData = CoreProto.TransportPackageData.parseFrom(params); CoreProto.ErrorInfo errInfo = packageData.getErr(); Command command = new Command(); command.setHeader(packageData.getHeaderMap()); command.setParams(packageData.getData().toByteArray()); // logger.info("netty client channel handler command={}", command.toString()); PlatformClientHandler.this.nettyClient .handleResponse(new RedisCommandResponse(redisCmd, errInfo.getCode(), errInfo.getInfo())); }
Example 2
Source File: GroupMessageImageSecretHandler.java From openzaly with Apache License 2.0 | 6 votes |
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) { CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime) .setMsgStatus(1).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(0, statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT) .add(data.toByteArray())); }
Example 3
Source File: PushClient.java From openzaly with Apache License 2.0 | 6 votes |
private static byte[] getResponseBytes(RedisCommand redisCommand) { try { String version = redisCommand.getParameterByIndex(0); String action = redisCommand.getParameterByIndex(1); byte[] params = redisCommand.getBytesParamByIndex(2); logger.debug("get package bytes from platform {},{},{}", version, action, params); if (CommandConst.ACTION_RES.equals(action)) { CoreProto.TransportPackageData packageData = CoreProto.TransportPackageData.parseFrom(params); CoreProto.ErrorInfo error = packageData.getErr(); if ("success".equals(error.getCode())) { return packageData.getData().toByteArray(); } } } catch (Exception e) { logger.error("get package bytes eror,redisCommand={}", redisCommand.toString()); } return null; }
Example 4
Source File: PlatformClientHandler.java From openzaly with Apache License 2.0 | 6 votes |
@Override protected void channelRead0(ChannelHandlerContext ctx, RedisCommand redisCmd) throws Exception { String version = redisCmd.getParameterByIndex(0); String action = redisCmd.getParameterByIndex(1); byte[] params = redisCmd.getBytesParamByIndex(2); CoreProto.TransportPackageData packageData = CoreProto.TransportPackageData.parseFrom(params); CoreProto.ErrorInfo errInfo = packageData.getErr(); Command command = new Command(); command.setHeader(packageData.getHeaderMap()); command.setParams(packageData.getData().toByteArray()); // logger.info("netty client channel handler command={}", command.toString()); PlatformClientHandler.this.nettyClient .handleResponse(new RedisCommandResponse(redisCmd, errInfo.getCode(), errInfo.getInfo())); }
Example 5
Source File: NettyClientHandler.java From openzaly with Apache License 2.0 | 6 votes |
@Override protected void channelRead0(ChannelHandlerContext ctx, RedisCommand redisCmd) throws Exception { String version = redisCmd.getParameterByIndex(0); String action = redisCmd.getParameterByIndex(1); byte[] params = redisCmd.getBytesParamByIndex(2); CoreProto.TransportPackageData packageData = CoreProto.TransportPackageData.parseFrom(params); CoreProto.ErrorInfo errInfo = packageData.getErr(); Command command = new Command(); command.setHeader(packageData.getHeaderMap()); command.setParams(packageData.getData().toByteArray()); // logger.info("netty client channel handler command={}", command.toString()); NettyClientHandler.this.nettyClient .handleResponse(new RedisCommandResponse(redisCmd, errInfo.getCode(), errInfo.getInfo())); }
Example 6
Source File: AbstractSyncHandler.java From openzaly with Apache License 2.0 | 6 votes |
/** * <pre> * status=1:发送成功 * status=0:默认发送失败状态 * status=-1:非好友,不能发送 * status=-2:非群成员,发送失败 * </pre> */ protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) { if (command == null || StringUtils.isEmpty(command.getDeviceId())) { return; } int statusValue = success ? 1 : 0; CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime) .setMsgStatus(statusValue).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 7
Source File: PlatformClient.java From openzaly with Apache License 2.0 | 6 votes |
private static byte[] getResponseBytes(RedisCommand redisCommand) { try { String version = redisCommand.getParameterByIndex(0); String action = redisCommand.getParameterByIndex(1); byte[] params = redisCommand.getBytesParamByIndex(2); logger.debug("get package bytes from platform {},{},{}", version, action, params); if (CommandConst.ACTION_RES.equals(action)) { CoreProto.TransportPackageData packageData = CoreProto.TransportPackageData.parseFrom(params); CoreProto.ErrorInfo error = packageData.getErr(); if ("success".equals(error.getCode())) { return packageData.getData().toByteArray(); } } } catch (Exception e) { logger.error("get package bytes eror,redisCommand={}", redisCommand.toString()); } return null; }
Example 8
Source File: AbstractU2Handler.java From openzaly with Apache License 2.0 | 6 votes |
/** * <pre> * status=1:发送成功 * status=0:默认发送失败状态 * status=-1:非好友,不能发送 * status=-2:非群成员,发送失败 * </pre> */ protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) { if (command == null || StringUtils.isEmpty(command.getDeviceId())) { return; } int statusValue = success ? 1 : 0; CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime) .setMsgStatus(statusValue).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 9
Source File: AbstractU2Handler.java From openzaly with Apache License 2.0 | 6 votes |
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) { if (command == null || StringUtils.isAnyEmpty(command.getDeviceId(), msgId)) { return; } CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue) .setMsgServerTime(msgTime).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 10
Source File: PushClient.java From wind-im with Apache License 2.0 | 6 votes |
private static byte[] getResponseBytes(RedisCommand redisCommand) { try { String version = redisCommand.getParameterByIndex(0); String action = redisCommand.getParameterByIndex(1); byte[] params = redisCommand.getBytesParamByIndex(2); logger.debug("get package bytes from platform {},{},{}", version, action, params); if (CommandConst.ACTION_RES.equals(action)) { CoreProto.TransportPackageData packageData = CoreProto.TransportPackageData.parseFrom(params); CoreProto.ErrorInfo error = packageData.getErr(); if ("success".equals(error.getCode())) { return packageData.getData().toByteArray(); } } } catch (Exception e) { logger.error("get package bytes eror,redisCommand={}", redisCommand.toString()); } return null; }
Example 11
Source File: GroupMessageImageSecretHandler.java From wind-im with Apache License 2.0 | 6 votes |
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) { CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime) .setMsgStatus(1).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(0, statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT) .add(data.toByteArray())); }
Example 12
Source File: GroupMessageTextSecretHandler.java From wind-im with Apache License 2.0 | 6 votes |
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) { CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime) .setMsgStatus(1).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(0, statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT) .add(data.toByteArray())); }
Example 13
Source File: AbstractGroupHandler.java From wind-im with Apache License 2.0 | 6 votes |
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) { if (command == null || StringUtils.isEmpty(command.getDeviceId())) { return; } CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue) .setMsgServerTime(msgTime).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 14
Source File: AbstractGroupHandler.java From wind-im with Apache License 2.0 | 6 votes |
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) { if (command == null || StringUtils.isEmpty(command.getDeviceId())) { return; } int statusValue = success ? 1 : 0; CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime) .setMsgStatus(statusValue).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 15
Source File: AbstractGroupHandler.java From openzaly with Apache License 2.0 | 6 votes |
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) { if (command == null || StringUtils.isEmpty(command.getDeviceId())) { return; } int statusValue = success ? 1 : 0; CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime) .setMsgStatus(statusValue).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 16
Source File: AbstractSyncHandler.java From openzaly with Apache License 2.0 | 6 votes |
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) { if (command == null || StringUtils.isEmpty(command.getDeviceId())) { return; } CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue) .setMsgServerTime(msgTime).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 17
Source File: AbstractU2Handler.java From wind-im with Apache License 2.0 | 6 votes |
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) { if (command == null || StringUtils.isAnyEmpty(command.getDeviceId(), msgId)) { return; } CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue) .setMsgServerTime(msgTime).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 18
Source File: AbstractGroupHandler.java From openzaly with Apache License 2.0 | 6 votes |
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) { if (command == null || StringUtils.isEmpty(command.getDeviceId())) { return; } CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue) .setMsgServerTime(msgTime).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION) .add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray())); }
Example 19
Source File: SyncGroupMessageHandler.java From openzaly with Apache License 2.0 | 4 votes |
private long groupMessageToClient(Channel channel, String userId, List<GroupMessageBean> groupMessageList) { long nextPointer = 0; ImStcMessageProto.ImStcMessageRequest.Builder requestBuilder = ImStcMessageProto.ImStcMessageRequest .newBuilder(); for (GroupMessageBean bean : groupMessageList) { try { nextPointer = NumUtils.getMax(nextPointer, bean.getId()); switch (bean.getMsgType()) { case CoreProto.MsgType.GROUP_TEXT_VALUE: CoreProto.GroupText groupText = CoreProto.GroupText.newBuilder().setMsgId(bean.getMsgId()) .setSiteUserId(bean.getSendUserId()).setSiteGroupId(bean.getSiteGroupId()) .setText(ByteString.copyFromUtf8(bean.getContent())).setTime(bean.getMsgTime()).build(); ImStcMessageProto.MsgWithPointer gmsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.GROUP_TEXT).setPointer(bean.getId()).setGroupText(groupText).build(); requestBuilder.addList(gmsg); break; case CoreProto.MsgType.GROUP_SECRET_TEXT_VALUE: // do nothing break; case CoreProto.MsgType.GROUP_IMAGE_VALUE: CoreProto.GroupImage groupImage = CoreProto.GroupImage.newBuilder().setMsgId(bean.getMsgId()) .setSiteUserId(bean.getSendUserId()).setSiteGroupId(bean.getSiteGroupId()) .setImageId(bean.getContent()).setTime(bean.getMsgTime()).build(); ImStcMessageProto.MsgWithPointer groupImageMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.GROUP_IMAGE).setPointer(bean.getId()).setGroupImage(groupImage).build(); requestBuilder.addList(groupImageMsg); break; case CoreProto.MsgType.GROUP_SECRET_IMAGE_VALUE: // do nothing break; case CoreProto.MsgType.GROUP_VOICE_VALUE: CoreProto.GroupVoice groupVoice = CoreProto.GroupVoice.newBuilder().setMsgId(bean.getMsgId()) .setSiteUserId(bean.getSendUserId()).setSiteGroupId(bean.getSiteGroupId()) .setVoiceId(bean.getContent()).setTime(bean.getMsgTime()).build(); ImStcMessageProto.MsgWithPointer groupVoiceMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.GROUP_VOICE).setPointer(bean.getId()).setGroupVoice(groupVoice).build(); requestBuilder.addList(groupVoiceMsg); break; case CoreProto.MsgType.GROUP_SECRET_VOICE_VALUE: // do nothing break; case CoreProto.MsgType.GROUP_NOTICE_VALUE: CoreProto.GroupMsgNotice groupNotice = CoreProto.GroupMsgNotice.newBuilder() .setMsgId(bean.getMsgId()).setSiteUserId(bean.getSendUserId()) .setSiteGroupId(bean.getSiteGroupId()).setText(ByteString.copyFromUtf8((bean.getContent()))) .setTime(bean.getMsgTime()).build(); ImStcMessageProto.MsgWithPointer groupMsgNotice = ImStcMessageProto.MsgWithPointer.newBuilder() .setPointer(bean.getId()).setType(MsgType.GROUP_NOTICE).setGroupMsgNotice(groupNotice) .build(); requestBuilder.addList(groupMsgNotice); break; case CoreProto.MsgType.GROUP_WEB_VALUE: WebBean webBean = GsonUtils.fromJson(bean.getContent(), WebBean.class); CoreProto.GroupWeb.Builder groupWeb = CoreProto.GroupWeb.newBuilder(); groupWeb.setMsgId(bean.getMsgId()).setSiteUserId(bean.getSendUserId()) .setSiteGroupId(bean.getSiteGroupId()).setWebCode(webBean.getWebCode()) .setHeight(webBean.getHeight()).setWidth(webBean.getWidth()).setTime(bean.getMsgTime()); if (StringUtils.isNotEmpty(webBean.getHrefUrl())) { groupWeb.setHrefUrl(webBean.getHrefUrl()); } ImStcMessageProto.MsgWithPointer groupWebMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setPointer(bean.getId()).setType(MsgType.GROUP_WEB).setGroupWeb(groupWeb).build(); requestBuilder.addList(groupWebMsg); break; case CoreProto.MsgType.GROUP_WEB_NOTICE_VALUE: WebBean webNoticeBean = GsonUtils.fromJson(bean.getContent(), WebBean.class); CoreProto.GroupWebNotice.Builder groupWebNotice = CoreProto.GroupWebNotice.newBuilder(); groupWebNotice.setMsgId(bean.getMsgId()).setSiteUserId(bean.getSendUserId()) .setSiteGroupId(bean.getSiteGroupId()).setWebCode(webNoticeBean.getWebCode()) .setHeight(webNoticeBean.getHeight()).setTime(bean.getMsgTime()); if (StringUtils.isNotEmpty(webNoticeBean.getHrefUrl())) { groupWebNotice.setHrefUrl(webNoticeBean.getHrefUrl()); } ImStcMessageProto.MsgWithPointer groupWebNoticeMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setPointer(bean.getId()).setType(MsgType.GROUP_WEB_NOTICE) .setGroupWebNotice(groupWebNotice).build(); requestBuilder.addList(groupWebNoticeMsg); break; default: break; } } catch (Exception e) { logger.error(StringHelper.format("sync group message error bean={}", bean), e); } } Map<Integer, String> header = new HashMap<Integer, String>(); header.put(CoreProto.HeaderKey.SITE_SERVER_VERSION_VALUE, CommandConst.SITE_VERSION); ImStcMessageProto.ImStcMessageRequest request = requestBuilder.build(); CoreProto.TransportPackageData datas = CoreProto.TransportPackageData.newBuilder().putAllHeader(header) .setData(ByteString.copyFrom(request.toByteArray())).build(); channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT) .add(datas.toByteArray())); return nextPointer; }
Example 20
Source File: GroupMessageVoiceSecretHandler.java From openzaly with Apache License 2.0 | 4 votes |
private void msgResponse(Channel channel, Command command, String from, String to, String msgId) { CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(1).build(); ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder() .setType(MsgType.MSG_STATUS).setStatus(status).build(); ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder() .addList(0, statusMsg).build(); CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder() .setData(request.toByteString()).build(); channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT) .add(data.toByteArray())); }