Refactoring into separate .hpp and .cpp files.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Compile with:
|
||||
// g++ -std=gnu++0x example-client-cpp11.cpp -o example-client-cpp11
|
||||
#define EASYWSCLIENT_COMPILATION_UNIT
|
||||
#include "easywsclient.hpp"
|
||||
#include "easywsclient.cpp" // <-- include only if you don't want compile separately
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
@@ -14,13 +14,10 @@ int main()
|
||||
ws->send("goodbye");
|
||||
ws->send("hello");
|
||||
while (true) {
|
||||
std::string message;
|
||||
ws->poll();
|
||||
ws->dispatch([&message](const std::string & message_) {
|
||||
printf(">>> %s\n", message_.c_str());
|
||||
message = message_;
|
||||
ws->dispatch([](const std::string & message) {
|
||||
printf(">>> %s\n", message.c_str());
|
||||
});
|
||||
if (message == "world") { break; }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user