• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ message_ptr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中message_ptr的典型用法代码示例。如果您正苦于以下问题:C++ message_ptr类的具体用法?C++ message_ptr怎么用?C++ message_ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了message_ptr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: task

rpc_request_task::rpc_request_task(message_ptr& request, service_node* node) 
    : task(task_code(request->header().local_rpc_code), request->header().client.hash, node), 
    _request(request)
{

    dbg_dassert (TASK_TYPE_RPC_REQUEST == spec().type, "task type must be RPC_REQUEST, please use DEFINE_TASK_CODE_RPC to define the task code");
}
开发者ID:SunnyGyb,项目名称:rDSN,代码行数:7,代码来源:task.cpp


示例2: marshall

int replication_app_base::dispatch_rpc_call(int code, message_ptr& request, bool ack_client)
{
    auto it = _handlers.find(code);
    if (it != _handlers.end())
    {
        if (ack_client)
        {
            message_ptr response = request->create_response();
            int err = 0;
            marshall(response->writer(), err);
            it->second(request, response);
        }
        else
        {
            message_ptr response(nullptr);
            it->second(request, response);
        }
    }
    else if (ack_client)
    {
        message_ptr response = request->create_response();
        error_code err = ERR_HANDLER_NOT_FOUND;
        marshall(response->writer(), (int)err);
        rpc::reply(response);
    }

    return 0;
}
开发者ID:CAH-FlyChen,项目名称:rDSN,代码行数:28,代码来源:replication_app_base.cpp


示例3: on_message

void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) {
    client::connection_ptr con = sip_client.get_con_from_hdl(hdl);

    std::cout << "Received a reply:" << std::endl;
    fwrite(msg->get_payload().c_str(), msg->get_payload().size(), 1, stdout);
    received=true;
}
开发者ID:2uropa,项目名称:cpprestsdk,代码行数:7,代码来源:sip_client.cpp


示例4: on_message

// Define a callback to handle incoming messages
void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) {
    try {
        s->send(hdl, msg->get_payload(), msg->get_opcode());
    } catch (const websocketpp::lib::error_code& e) {

    }
}
开发者ID:AlmirKadric,项目名称:uWebSockets,代码行数:8,代码来源:wsPP.cpp


示例5: on_message

 void on_message(connection_ptr con, message_ptr msg) {        
     if (con->get_resource() == "/getcasecount") {
         std::cout << "detected " << msg->get_payload() << " test cases." << std::endl;
         m_case_count = atoi(msg->get_payload().c_str());
     } else {
         con->send(msg->get_payload(),msg->get_opcode());
     }
 }
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:8,代码来源:echo_client.cpp


示例6: on_recv_request

    void rpc_server_session::on_recv_request(message_ptr& msg, int delay_ms)
    {
        msg->header().from_address = remote_address();
        msg->header().from_address.port = msg->header().client.port;
        msg->header().to_address = _net.address();

        msg->server_session().reset(this);
        return _net.on_recv_request(msg, delay_ms);
    }
开发者ID:yodamaster,项目名称:rDSN,代码行数:9,代码来源:network.cpp


示例7: on_message

void websocketIO::on_message(websocketpp::connection_hdl hdl, message_ptr msg) {
    boost::property_tree::ptree json;
    std::istringstream iss(msg->get_payload());
    boost::property_tree::read_json(iss, json);
    
    std::string func = json.get<std::string> ("func");
    if(messages.find(func) != messages.end()){
        messages[func](this, msg->get_payload());
    }
}
开发者ID:tmarrinan,项目名称:SAGE2_WebBrowser,代码行数:10,代码来源:websocketIO.cpp


示例8: on_message

// Define a callback to handle incoming messages
void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) {
    std::cout << " and message: " << msg->get_payload() <<std::endl ;
    std::cout << " opcode " << msg->get_opcode() <<std::endl ;

    //    s->send(hdl, msg->get_payload(), msg->get_opcode());

    const char* msge = "{\"GESTURE\":\"Move Left\"}";

    s->send(hdl, msge, websocketpp::frame::opcode::text);
}
开发者ID:flair2005,项目名称:gesture-recognition-for-human-robot-interaction,代码行数:11,代码来源:main.cpp


示例9: on_message

   void Handler::on_message(connection_ptr con, message_ptr msg)
   {
      if (msg->get_opcode() != websocketpp::frame::opcode::TEXT)
         return;

      Log::debug("client <%s>: <message> %s", plain(con).c_str(),
            msg->get_payload().c_str());

      publish(format_message(msg->get_payload()));
   }
开发者ID:ksergey,项目名称:playground,代码行数:10,代码来源:handler.cpp


示例10: recv_msg

    void sim_server_session::send(message_ptr& reply_msg)
    {
        message_ptr recv_msg(new message(reply_msg->writer().get_buffer()));
        recv_msg->header().from_address = reply_msg->header().from_address;
        recv_msg->header().to_address = reply_msg->header().to_address;

        _client->on_recv_reply(recv_msg->header().id, recv_msg,
            recv_msg->header().from_address == recv_msg->header().to_address ?
            0 : (static_cast<sim_network_provider*>(&_net))->net_delay_milliseconds()
            );
    }
开发者ID:SunnyGyb,项目名称:rDSN,代码行数:11,代码来源:network.sim.cpp


示例11: on_message

void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) {
    client::connection_ptr con = c->get_con_from_hdl(hdl);

    if (con->get_resource() == "/getCaseCount") {
        std::cout << "Detected " << msg->get_payload() << " test cases."
                  << std::endl;
        case_count = atoi(msg->get_payload().c_str());
    } else {
        c->send(hdl, msg->get_payload(), msg->get_opcode());
    }
}
开发者ID:MortimerGoro,项目名称:websocketpp,代码行数:11,代码来源:app_client.cpp


示例12: on_message

void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) {
    std::cout << "on_message called with hdl: " << hdl.lock().get()
              << " and message: " << msg->get_payload()
              << std::endl;

    try {
        s->send(hdl, msg->get_payload(), msg->get_opcode());
    } catch (const websocketpp::lib::error_code& e) {
        std::cout << "Echo failed because: " << e
                  << "(" << e.message() << ")" << std::endl;
    }
}
开发者ID:4ker,项目名称:websocketpp,代码行数:12,代码来源:echo_server_tls.cpp


示例13: handleRx

void ReadUncompressed::handleRx(const message_ptr message)
{
    if (!m_initialized)
    {
        m_initialized = check();
        if (!m_initialized) m_error = true;
    }
    else
    {
        if (message->get_opcode() == websocketpp::frame::opcode::binary)
        {
            const std::string& bytes(message->get_payload());
            const std::size_t rawNumBytes(bytes.size());
            const std::size_t stride(m_layout->pointSize());

            m_data.insert(m_data.end(), bytes.begin(), bytes.end());

            const std::size_t wholePoints(m_data.size() / stride);

            PointId nextId(m_view->size());
            const PointId doneId(nextId + wholePoints);

            const char* pos(m_data.data());

            while (nextId < doneId)
            {
                for (const auto& dim : m_layout->dims())
                {
                    m_view->setField(
                            dim,
                            m_layout->dimType(dim),
                            nextId,
                            pos);

                    pos += m_layout->dimSize(dim);
                }

                ++nextId;
            }

            m_numBytesReceived += rawNumBytes;
            m_data.assign(
                    m_data.begin() + wholePoints * stride,
                    m_data.end());
        }
        else
        {
            m_error = true;
        }
    }
}
开发者ID:Rafaelaniemann,项目名称:PDAL,代码行数:51,代码来源:Exchanges.cpp


示例14: on_message

void websocket_server::on_message(ws_socket* socket_, websocketpp::connection_hdl hdl, message_ptr msg) {
    
    if(msg->get_payload() == "CC"){
        cc_hdl_ = hdl;
        clientConnected = true;
        BOOST_LOG_TRIVIAL(info) << "Control Center connected via websocket";
    }
    else if (msg->get_payload() == "AL"){
        al_hdl_ = hdl;
        proxyConnected = true;
        BOOST_LOG_TRIVIAL(info) << "Al-Proxy connected via websocket";
    }
    
}
开发者ID:flair2005,项目名称:gesture-recognition-for-human-robot-interaction,代码行数:14,代码来源:websocket_server.cpp


示例15: response_client_message

void replica::response_client_message(message_ptr& request, error_code error, decree d/* = invalid_decree*/)
{
    if (nullptr == request)
        return;

    message_ptr resp = request->create_response();
    resp->writer().write(error);

    dassert(error != ERR_OK, "");
    dinfo("handle replication request with rpc_id = %016llx failed, err = %s",
        request->header().rpc_id, error.to_string());

    rpc::reply(resp);
}
开发者ID:lishenglong,项目名称:rDSN,代码行数:14,代码来源:replica.cpp


示例16: on_message

void chat_server_handler::on_message(connection_ptr con, message_ptr msg) {
    if (msg->get_opcode() != websocketpp::frame::opcode::text) {
        return;
    }
    
    std::cout << "message from client " << con << ": " << msg->get_payload() << std::endl;
    
    
    
    // check for special command messages
    if (msg->get_payload() == "/help") {
        // print command list
        con->send(encode_message("server","avaliable commands:<br />&nbsp;&nbsp;&nbsp;&nbsp;/help - show this help<br />&nbsp;&nbsp;&nbsp;&nbsp;/alias foo - set alias to foo",false));
        return;
    }
    
    if (msg->get_payload().substr(0,7) == "/alias ") {
        std::string response;
        std::string alias;
        
        if (msg->get_payload().size() == 7) {
            response = "you must enter an alias.";
            con->send(encode_message("server",response));
            return;
        } else {
            alias = msg->get_payload().substr(7);
        }
        
        response = m_connections[con] + " is now known as "+alias;

        // store alias pre-escaped so we don't have to do this replacing every time this
        // user sends a message
        
        // escape json characters
        boost::algorithm::replace_all(alias,"\\","\\\\");
        boost::algorithm::replace_all(alias,"\"","\\\"");
        
        // escape html characters
        boost::algorithm::replace_all(alias,"&","&amp;");
        boost::algorithm::replace_all(alias,"<","&lt;");
        boost::algorithm::replace_all(alias,">","&gt;");
        
        m_connections[con] = alias;
        
        // set alias
        send_to_all(serialize_state());
        send_to_all(encode_message("server",response));
        return;
    }
    
    // catch other slash commands
    if ((msg->get_payload())[0] == '/') {
        con->send(encode_message("server","unrecognized command"));
        return;
    }
    
    // create json message to send based on msg
    send_to_all(encode_message(m_connections[con],msg->get_payload()));
}
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:59,代码来源:chat.cpp


示例17: prepare_close

    lib::error_code prepare_close(close::status::value code,
        std::string const & reason, message_ptr out) const
    {
        if (!out) {
            return lib::error_code(error::invalid_arguments);
        }

        std::string val;
        val.append(1,'\xff');
        val.append(1,'\x00');
        out->set_payload(val);
        out->set_prepared(true);

        return lib::error_code();
    }
开发者ID:thomasouvre,项目名称:casablanca,代码行数:15,代码来源:hybi00.hpp


示例18: set_client_request

void mutation::set_client_request(task_code code, message_ptr& request)
{
    dassert(client_request == nullptr, "batch is not supported now");
    client_request = request;
    rpc_code = code;
    data.updates.push_back(request->reader().get_remaining_buffer());
}
开发者ID:jiangxianliang,项目名称:rDSN,代码行数:7,代码来源:mutation.cpp


示例19: on_remote_cli

    void command_manager::on_remote_cli(message_ptr& request)
    {
        std::string cmd;
        unmarshall(request->reader(), cmd);

        std::vector<std::string> args;
        unmarshall(request->reader(), args);

        std::string result;
        run_command(cmd, args, result);

        auto resp = request->create_response();
        marshall(resp->writer(), result);

        ::dsn::service::rpc::reply(resp);
    }
开发者ID:SunnyGyb,项目名称:rDSN,代码行数:16,代码来源:command_manager.cpp


示例20: rcvMessage

void WSConnection::rcvMessage (message_ptr msg, bool& msgRejected, bool& runQueue)
{
    ScopedLockType sl (m_receiveQueueMutex);

    if (m_isDead)
    {
        msgRejected = false;
        runQueue = false;
        return;
    }

    if ((m_receiveQueue.size () >= 1000) || (msg->get_payload().size() > 1000000))
    {
        msgRejected = true;
        runQueue = false;
    }
    else
    {
        msgRejected = false;
        m_receiveQueue.push_back (msg);

        if (m_receiveQueueRunning)
            runQueue = false;
        else
        {
            runQueue = true;
            m_receiveQueueRunning = true;
        }
    }
}
开发者ID:RagnarDanneskjold,项目名称:rippled,代码行数:30,代码来源:WSConnection.cpp



注:本文中的message_ptr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ meta_message_ptr类代码示例发布时间:2022-05-31
下一篇:
C++ message_id类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap