autobahn-cpp
autobahn-cpp copied to clipboard
handle_read_frame error
Hello, I seem to be running into a slight issue when I try to join a realm. I am using most of the example code for a subscriber except I am connecting to a wss url.
Below is my code:
`client ws_client;
ws_client.init_asio(&io);
ws_client.set_tls_init_handler(& {
return websocketpp::lib::make_sharedboost::asio::ssl::context(boost::asio::ssl::context::tlsv12_client);
});
auto transport
= std::make_shared < autobahn::wamp_websocketpp_websocket_transportwebsocketpp::config::asio_tls_client >(ws_
client, url, true);
// create a WAMP session that talks WAMP-RawSocket over TCP
auto session = std::make_shared<autobahn::wamp_session>(io, true);
transport->attach(std::static_pointer_cast<autobahn::wamp_transport_handler>(session));
// Make sure the continuation futures we use do not run out of scope prematurely.
// Since we are only using one thread here this can cause the io service to block
// as a future generated by a continuation will block waiting for its promise to be
// fulfilled when it goes out of scope. This would prevent the session from receiving
// responses from the router.
boost::future<void> connect_future;
boost::future<void> start_future;
boost::future<void> join_future;
boost::future<void> subscribe_future;
connect_future
= transport->connect().then
([&](boost::future<void> connected) {
try {
connected.get();
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
std::cerr << "transport connected" << std::endl;
start_future
= session->start().then
([&](boost::future<void> started) {
try {
started.get();
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
std::cerr << "session started" << std::endl;
join_future
= session->join("realm2").then
([&](boost::future<uint64_t> joined) {
try {
joined.get();
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
std::cerr << "Joined realm" << std::endl;
subscribe_future
= session->subscribe(topic1, &on_topic1).then
([&](boost::future<autobahn::wamp_subscription> subscribed) {
try {
std::cerr << "subscribed to topic: " << subscribed.get().id() << std::endl;
}
catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
io.stop();
return;
}
});
});
});
});
std::cerr << "starting io service" << std::endl;
io.run();
std::cerr << "stopped io service" << std::endl;
}
catch (std::exception& e) {
std::cerr << "exception: " << e.what() << std::endl;
}
return 0;
` I am able to connect to the session but I don't think I'm being able to join the realm or I'm getting disconnected before I can. This is the packet trace:
`starting io service [2017-08-26 14:32:42] [connect] Successful connection transport connected session started TX message (125 octets) ... TX message: hello ["realm2", {"authid":"", "authmethods":[], "roles":{"subscriber":{}, "callee":{"features":{"call_timeout":true}}, "publisher":{}, "caller":{"features":{"call_timeout":true}}}}] [2017-08-26 14:32:42] [frame_header] Dispatching write containing 1 message(s) containing 6 header bytes and 125 payload bytes [2017-08-26 14:32:42] [frame_header] Header Bytes: [0] (6) 82 FD 45 02 AA 95
[2017-08-26 14:32:42] [frame_payload] Payload Bytes: [0] (125) [2] D6 03 0C E7 20 63 C6 F8 77 81 0C F4 30 76 C2 FC 21 A2 01 F4 30 76 C2 F8 20 76 C2 FA 21 71 3A 30 37 6D C6 F0 36 86 00 E6 30 60 D9 F6 37 6B C8 F0 37 82 0C F6 24 6E C6 F0 20 83 02 F3 20 63 DE E0 37 67 D9 14 E9 61 CB F9 29 5D DE FC 28 67 C5 E0 31 C1 03 E5 30 60 C6 FC 36 6A CF E7 C5 A4 C9 F4 29 6E CF E7 C4 AA CC F0 24 76 DF E7 20 71 2B 39 26 63 C6 F9 1A 76 C3 F8 20 6D DF E1 86
[2017-08-26 14:32:42] [control] Control frame received with opcode 8 [2017-08-26 14:32:42] [frame_header] Dispatching write containing 1 message(s) containing 6 header bytes and 2 payload bytes [2017-08-26 14:32:42] [frame_header] Header Bytes: [0] (6) 88 82 3B 2E C0 0B
[2017-08-26 14:32:42] [frame_payload] Payload Bytes: [0] (2) [8] 38 C1
[2017-08-26 14:32:42] [error] handle_read_frame error: websocketpp.transport:8 (TLS Short Read) [2017-08-26 14:32:42] [disconnect] Disconnect close local:[1006,TLS Short Read] remote:[1007] stopped io service'
Any insight would be greatly appreciated.
I'm currently experiencing the same issue.
can you try rawsocket? to bisect the issue ..
I'm currently experiencing the same issue too.
Any news? I have same issue. I try WampSpart (C# library) and it works without problems, but autobahn with same server, realm not work and have behavior same with described here...