Update websockets.md

This commit is contained in:
Rob Godfrey 2023-05-28 22:25:31 -10:00 committed by GitHub
parent 3951788918
commit 849e2014dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1,8 +1,8 @@
Websockets are a way of connecting a client and a server without the request response nature of HTTP.<br><br>
Websockets are a way of connecting a client and a server without the request response nature of HTTP.<br>
## Routes
To create a websocket in Crow, you need a websocket route.<br>
A websocket route differs from a normal route quite a bit. It uses A slightly altered `CROW_WEBSOCKET_ROUTE(app, "/url")` macro, which is then followed by a series of methods (with handlers inside) for each event. These are (sorted by order of execution):
A websocket route differs from a normal route quite a bit. It uses a slightly altered `CROW_WEBSOCKET_ROUTE(app, "/url")` macro, which is then followed by a series of methods (with handlers inside) for each event. These are (sorted by order of execution):
- `#!cpp onaccept([&](const crow::request& req, void** userdata){handler code goes here})`