/erlang_websocket

WebSocket implementation in Erlang/Mochiweb, with a chat app.

Primary LanguageErlang

Erlang WebSocket wrapper for MochiWeb

This is a simple wrapper around the mochiweb_socket_server to allow WebSocket connections. With this wrapper, you can write WebSocket connection loops just like you’d write a normal mochiweb application.

This repo is forked from the Dave Bryson’s one, but I’m working on allowing two-way communication with the client, with one process listening for data from the client, and another one sending data back, so you can send him messages without waiting for him to act.

The chat server example is actually work in progress (and can be broken anytime), it will be released in a week or so, after a huge refactoring.

Requirements:

  1. Erlang 12.5 or greater
  2. Google Chrome Browser developer channel release 4.0.249.0

Getting Started:

  1. download the code
  2. CD into the erlang_websocket directory
  3. run make

Run the cate example:

  1. CD into the examples/basic directory
  2. run the ‘start.sh’ script with sudo (the flash policy server needs to bind top port 843).
  3. Point the Chrome Browser (or any other if you want to try the Flash fallback) to ‘http://localhost:8000’