Skip to content
Serge edited this page Oct 1, 2021 · 7 revisions

How to use Mochiweb and its websocket functionality?

How does the realtime stickynotes app work?

The original application by Beebole requires other connected clients 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 server
  2. initiate a websocket connection to mochiweb on the browser
  3. analyze the incoming request on the server
  4. initiate websocket session
  5. serve static files
  6. serve websocket request