Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ac000/websocket_demo
A demo of WebSockets in C
https://github.com/ac000/websocket_demo
c websocket websocket-protocol websocket-server websockets
Last synced: 7 days ago
JSON representation
A demo of WebSockets in C
- Host: GitHub
- URL: https://github.com/ac000/websocket_demo
- Owner: ac000
- License: mit
- Created: 2014-02-25T01:12:39.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-05-01T20:16:53.000Z (over 2 years ago)
- Last Synced: 2023-04-14T01:30:47.594Z (over 1 year ago)
- Topics: c, websocket, websocket-protocol, websocket-server, websockets
- Language: C
- Size: 54.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: MIT-LICENSE.txt
Awesome Lists containing this project
README
This is a simple demonstration of WebSockets in C. It simply consists of a
server and a HTML page.After it gets a connection, every two seconds (default) it will send
the hostname, uptime and rx & tx bytes of the system running the server
(can be the same as the client).Build the server (make), run it (non-root), then load the HTML page
into a browser. You should then see a simple page showing the above
information updating every two seconds. Change the interface to show
stats for and adjust the frequency of updates using the 'spinner' widget.Really simple, just shows the basics of what's needed for two way
communications.The WebSocket protocol is defined here: http://tools.ietf.org/html/rfc6455
It also demonstrates the use of epoll(7) to handle multiple connections
in a single process.It will also make use of libseccomp (if installed) to constrain what system
calls can be used once up and running. This really just serves as a
demonstration.It also implements WebSockets over TLS (wss://), this can be enabled by
passing 'tls' to the websocket_demo command. And by using
wss://localhost:1976/ as the websocket connection string in
websocket_demo.htmlYou will also need a TLS certificate and key (can be self made, required
some faffing about in Firefox to get it to work) and specify them in the
the TLS_CERT & TLS_KEY variables in websocket_demo.cLicensed under the MIT license, see MIT-LICENSE.txt