blob: 4b30fab9828279fdd6681fd4d1211a44e0de199f [file] [log] [blame]
Andy Greenb2149772010-10-31 13:15:56 +00001Using test-server as a quickstart
2---------------------------------
3
Andy Greena1e3ec02010-11-08 17:16:50 +00004For a Fedora x86_86 box, the following config line was
5needed:
6
7./configure --prefix=/usr --libdir=/usr/lib64 --enable-openssl
8
9otherwise if /usr/local/... and /usr/local/lib are OK then...
10
Andy Green3c974692010-11-08 17:04:09 +000011$ ./configure --enable-openssl
Andy Green05a0a7b2010-10-31 17:51:39 +000012$ make
Andy Green7310e9c2010-11-01 09:12:17 +000013$ sudo make install
14$ libwebsockets-test-server
Andy Greenb2149772010-10-31 13:15:56 +000015
16should be enough to get a test server listening on port 7861.
17
Andy Greened11a022011-01-20 10:23:50 +000018Testing
19-------
20
Andy Greenb2149772010-10-31 13:15:56 +000021If you point your browser (eg, Chrome) to
22
23 http://127.0.0.1:7681
24
Andy Green3c974692010-11-08 17:04:09 +000025It will fetch a script in the form of test.html, and then run the
Andy Green7310e9c2010-11-01 09:12:17 +000026script in there on the browser to open a websocket connection.
27Incrementing numbers should appear in the browser display.
Andy Greenb2149772010-10-31 13:15:56 +000028
Andy Greened11a022011-01-20 10:23:50 +000029Using SSL
30---------
31
Andy Green3c974692010-11-08 17:04:09 +000032To test it using SSL/WSS, just run the test server with
33
34$ libwebsockets-test-server --ssl
35
36and use the URL
37
38 https://127.0.0.1:7681
39
40The connection will be entirely encrypted using some generated
41certificates that your browser will not accept, since they are
42not signed by any real Certificate Authority. Just accept the
43certificates in the browser and the connection will proceed
44in first https and then websocket wss, acting exactly the
45same.
46
Andy Greenb2149772010-10-31 13:15:56 +000047test-server.c is all that is needed to use libwebsockets for
48serving both the script html over http and websockets.
49
Andy Greened11a022011-01-20 10:23:50 +000050Forkless operation
51------------------
52
53If your target device does not offer fork(), you can use
54libwebsockets from your own main loop instead. Use the
55configure option --nofork and simply call libwebsocket_service()
56from your own main loop as shown in the test app sources.
57
58
59Websocket version supported
60---------------------------
61
62Right now this is tested and working on websockets protocol 76/00
63Untested code is in for 04 support, there is no browser support
64available yet to test it with. Libwebsockets should autoselect
65between the supported versions according to what the browser
66asks for.
67
682011-01-20 Andy Green <andy@warmcat.com>
Andy Greenb2149772010-10-31 13:15:56 +000069