New interface a la designated initializers

This commit is contained in:
Alex Hultman
2018-11-22 00:20:38 +01:00
parent 519c1f5b60
commit fb70cf78e1
2 changed files with 27 additions and 23 deletions
+14 -18
View File
@@ -5,32 +5,28 @@
int main(int argc, char **argv) {
// do websockets here
/*
uWS::App().ws("/*", {
.open = []() {
// here we have it
uWS::App().get("/hello", [](auto *res, auto *req) {
res->end("Hello HTTP!");
}).ws("/*", {
/*.open = */[](auto *ws, auto *req) {
},
.message = []() {
/*.message = */[](auto *ws, std::string_view message, uWS::OpCode opCode) {
ws->send(message, opCode);
}
/*.drain = []() {
},
.drain = []() {
.ping = []() {
},
.pong = []() {
},
.close = []() {
}
}).listen().run();*/
uWS::App().get("/hello", [](auto *res, auto *req) {
res->end("Hello HTTP!");
}).ws("/*", [](auto *ws, auto *req) {
std::cout << "WebSocket conntected to URL: " << req->getUrl() << std::endl;
}, [](auto *ws, std::string_view message, uWS::OpCode opCode) {
ws->send(message, opCode);
}*/
}).listen(9001, [](auto *token) {
if (token) {
std::cout << "Listening on port " << 3000 << std::endl;