Andy Green | b214977 | 2010-10-31 13:15:56 +0000 | [diff] [blame] | 1 | Using test-server as a quickstart |
| 2 | --------------------------------- |
| 3 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame^] | 4 | $ ./configure --enable-openssl |
Andy Green | 05a0a7b | 2010-10-31 17:51:39 +0000 | [diff] [blame] | 5 | $ make |
Andy Green | 7310e9c | 2010-11-01 09:12:17 +0000 | [diff] [blame] | 6 | $ sudo make install |
| 7 | $ libwebsockets-test-server |
Andy Green | b214977 | 2010-10-31 13:15:56 +0000 | [diff] [blame] | 8 | |
| 9 | should be enough to get a test server listening on port 7861. |
| 10 | |
| 11 | If you point your browser (eg, Chrome) to |
| 12 | |
| 13 | http://127.0.0.1:7681 |
| 14 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame^] | 15 | It will fetch a script in the form of test.html, and then run the |
Andy Green | 7310e9c | 2010-11-01 09:12:17 +0000 | [diff] [blame] | 16 | script in there on the browser to open a websocket connection. |
| 17 | Incrementing numbers should appear in the browser display. |
Andy Green | b214977 | 2010-10-31 13:15:56 +0000 | [diff] [blame] | 18 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame^] | 19 | To test it using SSL/WSS, just run the test server with |
| 20 | |
| 21 | $ libwebsockets-test-server --ssl |
| 22 | |
| 23 | and use the URL |
| 24 | |
| 25 | https://127.0.0.1:7681 |
| 26 | |
| 27 | The connection will be entirely encrypted using some generated |
| 28 | certificates that your browser will not accept, since they are |
| 29 | not signed by any real Certificate Authority. Just accept the |
| 30 | certificates in the browser and the connection will proceed |
| 31 | in first https and then websocket wss, acting exactly the |
| 32 | same. |
| 33 | |
Andy Green | b214977 | 2010-10-31 13:15:56 +0000 | [diff] [blame] | 34 | test-server.c is all that is needed to use libwebsockets for |
| 35 | serving both the script html over http and websockets. |
| 36 | |
Andy Green | 3c97469 | 2010-11-08 17:04:09 +0000 | [diff] [blame^] | 37 | 2010-11-08 Andy Green <andy@warmcat.com> |
Andy Green | b214977 | 2010-10-31 13:15:56 +0000 | [diff] [blame] | 38 | |