-
Notifications
You must be signed in to change notification settings - Fork 1
A demo of WebSockets in C
License
ac000/websocket_demo
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.html You 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.c Licensed under the MIT license, see MIT-LICENSE.txt
About
A demo of WebSockets in C
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published