Skip to content

How to use Mochiweb and its websocket functionality?

Serge edited this page Sep 30, 2021 · 1 revision

How does the realtime stickynotes app work?

The original application by Beebole requires all to refresh the browser to see the changes. It uses AJAX with HTTP get or post requests. I always wanted to add real time pushes to it, and it felt natural to use web sockets for that rather than the Comet' long poll approach.

The plan

  1. start the mochiweb web server
  2. initiate a websocket connection to it from the browser
  3. analyze the incoming request on the server
  4. initiate websocket session
  5. serve static files
  6. serve websocket request