Yet another web socket chat room. This one uses Ruby, EventMachine, Redis pub/sub, and web sockets via jQuery.
Back end first. Install Redis if you have not already.
Here’s a few required gems. file: Gemfile
Up next: EventMachine server. This script handles the backend pubsub and web socket connections. file: server_em.rb
I then created a simple sinatra front end server. file: server.web.rb
Some front end html. file: views/chat_room.erb
Some jQuery web socket and form processing code. file: public/js/chat.js
Run the servers.
Screenshot of chat room.
Source code on GitHub.