These are the steps I did to compile the cWebSocket (https://github.com/m8rge/cwebsocket) :
alan@machine:~/cwebsocket/lib$ gcc -c websocket.c -o websocket.o alan@machine:~/cwebsocket/lib$ ar rcs libwebsocket.a websocket.o alan@machine:~/cwebsocket/lib$ ls -l total 60 -rw-rw-r-- 1 alan alan 2307 Jun 3 13:15 aw-base64.h -rw-rw-r-- 1 alan alan 3589 Jun 3 13:15 aw-sha1.h -rw-rw-r-- 1 alan alan 14108 Jun 3 17:19 libwebsocket.a -rw-rw-r-- 1 alan alan 11144 Jun 3 13:15 websocket.c -rw-rw-r-- 1 alan alan 4902 Jun 3 13:15 websocket.h -rw-rw-r-- 1 alan alan 13856 Jun 3 17:19 websocket.o alan@machine:~/cwebsocket/lib$ cd ../x86_server/ alan@machine:~/cwebsocket/x86_server$ gcc -I../lib/ -L../lib/ main.c -o websocket -lwebsocket
This is the debug when opening the client.html example:
$ ./websocket opened 0.0.0.0:8088 connected 127.0.0.1:36808 in packet: GET /echo HTTP/1.1 Host: localhost:8088 User-Agent: Mozilla... Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Sec-WebSocket-Version: 13 Origin: null Sec-WebSocket-Extensions: permessage-deflate Sec-WebSocket-Key: 4MHamm...== Connection: keep-alive, Upgrade Pragma: no-cache Cache-Control: no-cache Upgrade: websocket out packet: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: Gg+sXSeGc...= in packet: ��c^�M;�9 0� out packet: �testing