本文整理汇总了C++中ConnectionPtr::addRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionPtr::addRequest方法的具体用法?C++ ConnectionPtr::addRequest怎么用?C++ ConnectionPtr::addRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionPtr
的用法示例。
在下文中一共展示了ConnectionPtr::addRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AppException
AckChatMsg::AckChatMsg(InstancePtr instance, const UserID& target_uid, msg_id_t msg_id, AckChatMsg::CallbackPtr cb)
{
if (!msg_id)
throw AppException("msg id is null");
instant_messaging_server::methods::rpc::AckChatMsgRequest ack_chat_req;
ack_chat_req.mutable_sender_usr_id()->set_uid(target_uid.uid);
if (!target_uid.domain.empty())
ack_chat_req.mutable_sender_usr_id()->set_domain(target_uid.domain);
ack_chat_req.set_msg_id(msg_id);
ConnectionPtr conn = instance->getConnection("ua");
seq_t seq = conn->getNextSeq();
MsgBody body;
body.addTarget("im");
body.addRequest(instant_messaging_server::methods::rpc::CmdID_AckChatMsg, seq, 0, ack_chat_req);
conn->send(rpc::OP_REQUEST, body);
conn->addRequest(seq, cb);
}
示例2: AppException
AckGroupSysMsg::AckGroupSysMsg(InstancePtr instance, const GroupID& group_id, const string& channel, msg_id_t sysmsg_id, AckGroupSysMsg::CallbackPtr cb)
{
if (!sysmsg_id)
throw AppException("sysmsg id is null");
group_messaging_server::methods::rpc::AckGrpSysMsgRequest ack_sys_req;
if (!channel.empty())
ack_sys_req.set_channel(channel);
ack_sys_req.set_sysmsg_id(sysmsg_id);
ConnectionPtr conn = instance->getConnection("ua");
seq_t seq = conn->getNextSeq();
Uri target;
createUri(&target, "grp", group_id);
MsgBody body;
body.addTarget(target);
body.addRequest(group_messaging_server::methods::rpc::CmdID_AckGrpSysMsg, seq, 0, ack_sys_req);
conn->send(rpc::OP_REQUEST, body);
conn->addRequest(seq, cb);
}