Variation of helloworld that does not use a broker, but listens for incoming connections itself. It establishes a connection to itself with a link over which a single message is sent. This demonstrates the ease with which a simple daemon an be built using the API.
#include <iostream>
#include "fake_cpp11.hpp"
private:
std::string url;
public:
hello_world_direct(const std::string& u) : url(u) {}
}
}
std::cout << m.
body() << std::endl;
}
}
};
int main(int argc, char **argv) {
try {
std::string url = argc > 1 ? argv[1] : "127.0.0.1:8888/examples";
hello_world_direct hwd(url);
return 0;
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
}
return 1;
}