1 Using test-server as a quickstart
2 ---------------------------------
4 For a Fedora x86_86 box, the following config line was
7 ./configure --prefix=/usr --libdir=/usr/lib64 --enable-openssl
9 otherwise if /usr/local/... and /usr/local/lib are OK then...
11 $ ./configure --enable-openssl
15 $ libwebsockets-test-server
17 should be enough to get a test server listening on port 7861.
19 There are a couple of other possible configure options
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.
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.
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.
40 Testing server with a browser
41 -----------------------------
43 If you point your browser (eg, Chrome) to
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.
51 Using SSL on the server side
52 ----------------------------
54 To test it using SSL/WSS, just run the test server with
56 $ libwebsockets-test-server --ssl
60 https://127.0.0.1:7681
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
69 test-server.c is all that is needed to use libwebsockets for
70 serving both the script html over http and websockets.
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.
82 Testing websocket client support
83 --------------------------------
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.
88 $ libwebsockets-test-client localhost
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.
97 Testing SSL on the client side
98 ------------------------------
100 To test SSL/WSS client action, just run the client test with
102 $ libwebsockets-test-client localhost --ssl
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.
110 Websocket version supported
111 ---------------------------
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.
117 2011-01-22 Andy Green <andy@warmcat.com>