コード例 #1
0
pplx::task<std::string> websocket_incoming_message::extract_string() const
{
    if (m_msg_type == websocket_message_type::binary_message)
    {
        return pplx::task_from_exception<std::string>(websocket_exception("Invalid message type"));
    }
    return pplx::task_from_result(std::move(m_body.collection()));
}
コード例 #2
0
ファイル: ws_msg.cpp プロジェクト: thomasouvre/casablanca
pplx::task<std::string> websocket_incoming_message::extract_string() const
{
    if (_m_impl->message_type() == websocket_message_type::binary_message)
    {
        return pplx::task_from_exception<std::string>(websocket_exception(_XPLATSTR("Invalid message type")));
    }

    auto m_impl = _m_impl;

    return pplx::create_task(_m_impl->_get_data_available()).then([m_impl]() { return m_impl->_extract_string(); });
}