mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
![]() During client redirect we "reset" the wsi to the redirect address, involving closing the current fd that was told to redirect (it will usually be a completely different server or port). With libuv and its two-stage close that's not trivial. This solves the problem we will "reset" (overwrite) where the handle lives in the wsi with new a new connection / handle by having it copied out into an allocated watcher struct, which is freed in the uv close callback. To confirm it the minimal ws client example gets some new options, the original problem was replicated with this $ lws-minimal-ws-client-echo -s invalid.url.com -p 80 https://github.com/warmcat/libwebsockets/issues/1390 |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
minimal-ws-client-echo.c | ||
protocol_lws_minimal_client_echo.c | ||
README.md |
lws minimal ws client + permessage-deflate echo
This example opens a ws client connection to localhost:7681 and echoes back anything that comes from the server.
You can use it for testing lws against Autobahn.
build
$ cmake . && make
usage
Commandline option | Meaning |
---|---|
-d | Debug verbosity in decimal, eg, -d15 |
-p port | Port to connect to |
-u url | URL path part to connect to |
-o | Finish after one connection |
$ ./lws-minimal-ws-client-echo
[2018/04/22 20:03:50:2343] USER: LWS minimal ws client echo + permessage-deflate + multifragment bulk message
[2018/04/22 20:03:50:2344] USER: lws-minimal-ws-client-echo [-n (no exts)] [-u url] [-o (once)]
[2018/04/22 20:03:50:2344] USER: options 0
[2018/04/22 20:03:50:2345] NOTICE: Creating Vhost 'default' (serving disabled), 1 protocols, IPv6 off
[2018/04/22 20:03:51:2356] USER: connecting to localhost:9001//runCase?case=362&agent=libwebsockets
[2018/04/22 20:03:51:2385] NOTICE: checking client ext permessage-deflate
[2018/04/22 20:03:51:2386] NOTICE: instantiating client ext permessage-deflate
[2018/04/22 20:03:51:2386] USER: LWS_CALLBACK_CLIENT_ESTABLISHED
...