Git Product home page Git Product logo

websocket_demo's Introduction

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

websocket_demo's People

Contributors

ac000 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.