Thu
May 28th

JsChat

JsChat is a simple open source realtime chat protocol based on JSON.  There’s a server and console and web clients.  It’s developed by the Quite Useful authors.  Download it from my GitHub repository: github.com/alexyoung/jschat, and read more at the JsChat Blog.

Web Client

Most people who have tried JsChat think it’s all about the web client, but this is only a proof of concept I built to illustrate how simple implementing the JSON-based protocol can be.  It’s made with Ruby and Sinatra (Sinatra is a tiny Ruby web framework).

It has a few interesting features:

  • YouTube URLs are automatically embedded so people can watch them
  • Image URLs are embedded too
  • Tab completion for names
  • Joining a room gives you the last 100 lines, so you can safely leave and come back
  • Rooms are just denoted by a hash part in the URL: jschat.org/chat/#jschat
  • It’s possible to open multiple tabs in your browser and sit in multiple rooms
  • It polls using simple Ajax calls which means it’ll run in lots of browsers (I’ll experiment with detecting browser-specific push capabilities in the future)

Console Client

The console client is written with Ruby and Ncurses.  You can connect to JsChat.org by downloading it and running:

./client.rb jschat.org

It’ll pick up your name from the system and auto-join #jschat.  You can join multiple rooms and switch between them using /switch (or /s).  Type /help for more commands.

I’m not particularly good at Ncurses, so I’m waiting for someone to help clean it up!

Running Your Own Server

I’m going to blog more about how to run the web app alongside the core server with Apache and mod_proxy, with strategies for keeping them running (I’ll start with monit examples).

If you’d like to try it locally, just run:

./server.rb

./client.rb

Authors

Protocol creation and initial server, client and web app: Alex Young (message me on GitHub or @alex_young for more info about JsChat)

Initial concept, testing, feature suggestions: Kevin Ford

Bug fixes and code contributions: Simon Starr, Ric Roberts, Nick Martini, Jenf

JavaScript sanity checker: gabrielg

Comments (View)
Related Posts Widget for Blogs by LinkWithin