introduce-ssl-client-connections--flow-control.patch
[profile/ivi/libwebsockets.git] / README-test-server
1 Using test-server as a quickstart
2 ---------------------------------
3
4 For a Fedora x86_86 box, the following config line was
5 needed:
6
7 ./configure --prefix=/usr --libdir=/usr/lib64 --enable-openssl
8
9 otherwise if /usr/local/... and /usr/local/lib are OK then...
10
11 $ ./configure --enable-openssl
12 $ make clean
13 $ make
14 $ sudo make install
15 $ libwebsockets-test-server
16
17 should be enough to get a test server listening on port 7861.
18
19 There are a couple of other possible configure options
20
21 --enable-nofork         disables the fork into the background API
22                         and removes all references to fork() and
23                         pr_ctl() from the sources.  Use it if your
24                         platform doesn't support forking.
25
26 --enable-libcrypto      by default libwebsockets uses its own
27                         built-in md5 and sha-1 implementation for
28                         simplicity.  However the libcrypto ones
29                         may be faster, and in a distro context it
30                         may be highly desirable to use a common
31                         library implementation for ease of security
32                         upgrades.  Give this configure option
33                         to disable the built-in ones and force use
34                         of the libcrypto (part of openssl) ones.
35
36 --with-client-cert-dir=dir   tells the client ssl support where to
37                              look for trust certificates to validate
38                              the remote certificate against.
39
40 Testing server with a browser
41 -----------------------------
42
43 If you point your browser (eg, Chrome) to
44
45   http://127.0.0.1:7681
46
47 It will fetch a script in the form of test.html, and then run the
48 script in there on the browser to open a websocket connection.
49 Incrementing numbers should appear in the browser display.
50
51 Using SSL on the server side
52 ----------------------------
53
54 To test it using SSL/WSS, just run the test server with
55
56 $ libwebsockets-test-server --ssl
57
58 and use the URL
59
60   https://127.0.0.1:7681
61
62 The connection will be entirely encrypted using some generated
63 certificates that your browser will not accept, since they are
64 not signed by any real Certificate Authority.  Just accept the
65 certificates in the browser and the connection will proceed
66 in first https and then websocket wss, acting exactly the
67 same.
68
69 test-server.c is all that is needed to use libwebsockets for
70 serving both the script html over http and websockets.
71
72
73 Forkless operation
74 ------------------
75
76 If your target device does not offer fork(), you can use
77 libwebsockets from your own main loop instead.  Use the
78 configure option --nofork and simply call libwebsocket_service()
79 from your own main loop as shown in the test app sources.
80
81
82 Testing websocket client support
83 --------------------------------
84
85 If you run the test server as described above, you can also
86 connect to it using the test client as well as a browser.
87
88 $ libwebsockets-test-client localhost
89
90 will by default connect to the test server on localhost:7681
91 and print the dumb increment number from the server at the
92 same time as drawing random circles in the mirror protocol;
93 if you connect to the test server using a browser at the
94 same time you will be able to see the circles being drawn.
95
96
97 Testing SSL on the client side
98 ------------------------------
99
100 To test SSL/WSS client action, just run the client test with
101
102 $ libwebsockets-test-client localhost --ssl
103
104 By default the client test applet is set to accept selfsigned
105 certificates used by the test server, this is indicated by the
106 use_ssl var being set to 2.  Set it to 1 to reject any server
107 certificate that it doesn't have a trusted CA cert for.
108
109
110 Websocket version supported
111 ---------------------------
112
113 The websocket client code is 04 version, the server supports
114 both 00/76 in text mode and 04 dynamically per-connection
115 depending on the version of the client / browser.
116
117 2011-01-22  Andy Green <andy@warmcat.com>
118