Session
The zenoh session is created using the zenoh::open()
function,
consuming the configuration object zenoh::Config
.
#include "zenoh.hxx"
using namespace zenoh;
int main(int argc, char **argv) {
try {
Config config;
// take Session from std::variant
auto session = expect<Session>(open(std::move(config)));
session.put("demo/example/simple", "Simple!");
} catch (ErrorMessage e) {
// Exception comes from ``expect``, the zenoh-cpp itself does not throw any exception
std::cout << "Received an error :" << e.as_string_view() << "\n";
}
}