client: add libuv support to lws_client_reset
[platform/upstream/libwebsockets.git] / README.test-apps.md
index 240011b..e863db7 100644 (file)
@@ -1,8 +1,53 @@
+Overview of lws test apps
+=========================
+
+Are you building a client?  You just need to look at the test client
+[libwebsockets-test-client](test-server/test-client.c).
+
+If you are building a standalone server, there are three choices, in order of
+preferability.
+
+1) lwsws + protocol plugins
+
+Lws provides a generic web server app that can be configured with JSON
+config files.  https://libwebsockets.org itself uses this method.
+
+With lwsws handling the serving part, you only need to write an lws protocol
+plugin.  See [plugin-standalone](plugin-standalone) for an example of how
+to do that outside lws itself, using lws public apis.
+
+ $ cmake .. -DLWS_WITH_LWSWS=1
+
+See [README.lwsws.md](README.lwsws.md) for information on how to configure
+lwsws.
+
+NOTE this method implies libuv is used by lws, to provide crossplatform
+implementations of timers, dynamic lib loading etc for plugins and lwsws.
+
+2) test-server-v2.0.c
+
+This method lets you configure web serving in code, instead of using lwsws.
+
+Plugins are still used, which implies libuv needed.
+
+ $ cmake .. -DLWS_WITH_PLUGINS=1
+
+See [test-server-v2.0.c](test-server/test-server-v2.0.c)
+
+3) protocols in the server app
+
+This is the original way lws implemented servers, plugins and libuv are not
+required, but without plugins separating the protocol code directly, the
+combined code is all squidged together and is much less maintainable.
+
+This method is still supported in lws but all ongoing and future work is
+being done in protocol plugins only.
+
+
 Notes about lws test apps
 =========================
 
-Testing server with a browser
------------------------------
+@section tsb Testing server with a browser
 
 If you run [libwebsockets-test-server](test-server/test-server.c) and point your browser
 (eg, Chrome) to
@@ -17,8 +62,7 @@ By default the test server logs to both stderr and syslog, you can control
 what is logged using `-d <log level>`, see later.
 
 
-Running test server as a Daemon
--------------------------------
+@section tsd Running test server as a Daemon
 
 You can use the -D option on the test server to have it fork into the
 background and return immediately.  In this daemonized mode all stderr is
@@ -39,8 +83,7 @@ If the lock is valid, the daemon will exit with a note on stderr that
 it was already running.
 
 
-Using SSL on the server side
-----------------------------
+@section sssl Using SSL on the server side
 
 To test it using SSL/WSS, just run the test server with
 ```
@@ -61,8 +104,7 @@ same.
 serving both the script html over http and websockets.
 
 
-Testing websocket client support
---------------------------------
+@section wscl Testing websocket client support
 
 If you run the test server as described above, you can also
 connect to it using the test client as well as a browser.
@@ -83,13 +125,12 @@ The test client supports SSL too, use
        $ libwebsockets-test-client localhost --ssl -s
 ```
 
-the -s tells it to accept the default selfsigned cert from the server,
+the -s tells it to accept the default self-signed cert from the server,
 otherwise it will strictly fail the connection if there is no CA cert to
 validate the server's certificate.
 
 
-Choosing between test server variations
----------------------------------------
+@section choosingts Choosing between test server variations
 
 If you will be doing standalone serving with lws, ideally you should avoid
 making your own server at all, and use lwsws with your own protocol plugins.
@@ -103,8 +144,7 @@ that's not possible then the other variations with their own protocol code
 should be considered.
 
 
-Testing simple echo
--------------------
+@section echo Testing simple echo
 
 You can test against `echo.websockets.org` as a sanity test like
 this (the client connects to port `80` by default):
@@ -127,21 +167,19 @@ If you add the `--ssl` switch to both the client and server, you can also test
 with an encrypted link.
 
 
-Testing SSL on the client side
-------------------------------
+@section tassl Testing SSL on the client side
 
 To test SSL/WSS client action, just run the client test with
 ```
        $ libwebsockets-test-client localhost --ssl
 ```
-By default the client test applet is set to accept selfsigned
+By default the client test applet is set to accept self-signed
 certificates used by the test server, this is indicated by the
 `use_ssl` var being set to `2`.  Set it to `1` to reject any server
 certificate that it doesn't have a trusted CA cert for.
 
 
-Using the websocket ping utility
---------------------------------
+@section taping Using the websocket ping utility
 
 libwebsockets-test-ping connects as a client to a remote
 websocket server and pings it like the
@@ -183,12 +221,11 @@ Before you can even use the PING opcode that is part of the
 standard, you must complete a handshake with a specified
 protocol.  By default lws-mirror-protocol is used which is
 supported by the test server.  But if you are using it on
-another server, you can specify the protcol to handshake with
+another server, you can specify the protocol to handshake with
 by `--protocol=protocolname`
 
 
-Fraggle test app
-----------------
+@section ta fraggle Fraggle test app
 
 By default it runs in server mode
 ```
@@ -231,8 +268,7 @@ same checksum using websocket framing to see when the message has ended.  It
 then accepts the server checksum message and compares that to its checksum.
 
 
-proxy support
--------------
+@section taproxy proxy support
 
 The http_proxy environment variable is respected by the client
 connection code for both `ws://` and `wss://`.  It doesn't support
@@ -244,16 +280,18 @@ You use it like this
        $ libwebsockets-test-client someserver.com
 ```
 
-debug logging
--------------
+@section talog debug logging
 
 By default logging of severity "notice", "warn" or "err" is enabled to stderr.
 
 Again by default other logging is compiled in but disabled from printing.
 
-If you want to eliminate the debug logging below notice  in severity, use the
-`--disable-debug` configure option to have it removed from the code by the
-preprocesser.
+By default debug logs below "notice" in severity are not compiled in.  To get
+them included, add this option in CMAKE
+
+```
+       $ cmake .. -DCMAKE_BUILD_TYPE=DEBUG
+```
 
 If you want to see more detailed debug logs, you can control a bitfield to
 select which logs types may print using the `lws_set_log_level()` api, in the
@@ -272,15 +310,13 @@ available are (OR together the numbers to select multiple)
  - 512 LATENCY
 
 
-Websocket version supported
----------------------------
+@section ws13 Websocket version supported
 
 The final IETF standard is supported for both client and server, protocol
 version 13.
 
 
-Latency Tracking
-----------------
+@section latency Latency Tracking
 
 Since libwebsockets runs using `poll()` and a single threaded approach, any
 unexpected latency coming from system calls would be bad news.  There's now
@@ -303,8 +339,7 @@ that time, such as the browser, it may simply indicate the OS gave preferential
 treatment to the other app during that call.
 
 
-Autobahn Test Suite
--------------------
+@section autobahn Autobahn Test Suite
 
 Lws can be tested against the autobahn websocket fuzzer.
 
@@ -331,13 +366,12 @@ file:///projects/libwebsockets/reports/clients/index.html
 to see the results
 
 
-Autobahn Test Notes
--------------------
+@section autobahnnotes Autobahn Test Notes
 
 1) Autobahn tests the user code + lws implementation.  So to get the same
-results, you need to follow test-echo.c in terms of user implmentation.
+results, you need to follow test-echo.c in terms of user implementation.
 
-2) Some of the tests make no sense for Libwebsockets to support and we fail them.
+2) Two of the tests make no sense for Libwebsockets to support and we fail them.
 
  - Tests 2.10 + 2.11: sends multiple pings on one connection.  Lws policy is to
 only allow one active ping in flight on each connection, the rest are dropped.