diff --git a/README.md b/README.md index dca2892..e6eb5f4 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ uWS::SSLApp({ }).ws("/*", { /* Just a few of the available handlers */ - .open = [](auto *ws, auto *req) { + .open = [](auto *ws) { /* MQTT syntax */ ws->subscribe("sensors/+/house"); }, diff --git a/misc/READMORE.md b/misc/READMORE.md index 70e9655..db7eea9 100644 --- a/misc/READMORE.md +++ b/misc/READMORE.md @@ -119,8 +119,12 @@ uWS::App().ws("/*", { .maxPayloadLength = 16 * 1024, .idleTimeout = 10, /* Handlers */ - .open = [](auto *ws, auto *req) { - /* Here you can use req just like as for Http */ + .upgrade = [](auto *res, auto *req, auto *context) { + /* You may read from req only here, and COPY whatever you need into your PerSocketData. + * See UpgradeSync and UpgradeAsync examples. */ + }, + .open = [](auto *ws) { + }, .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) { ws->send(message, opCode); diff --git a/misc/main.cpp b/misc/main.cpp index 4069aac..57238b5 100644 --- a/misc/main.cpp +++ b/misc/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char **argv) { .maxPayloadLength = 16 * 1024 * 1024, .idleTimeout = 10, /* Handlers */ - .open = [](auto *ws, auto *req) { + .open = [](auto *ws) { std::cout << "WebSocket connected" << std::endl; /* Access per socket data */ PerSocketData *perSocketData = (PerSocketData *) ws->getUserData();