Operational-Transformation/ot.js — pull request #14 by jfromaniello (2013-02-05 14:49:11+00:00)
Title: codemirror server for socket.io room

I have added ```codemirror-server-room``` which is another server like ```codemirror-server``` but this one works (i.e. broadcast) to only one [socket.io room](https://github.com/LearnBoost/socket.io/wiki/Rooms).

The idea is that you will have one server per document and each server will use a socket.io room.

The server does not automatically connect every socket to itself, you have to manually call ```server.hook(socket, name)``` in order to connect.

The server has a pseudo-event named 'EmptyRoom', ```server.onEmptyRoom = func..``` you can use this method to dispose the server from memory when all users leave the room.

A demo of how to use it can be found on [my fork of ot.js-demo](http://github.com/jfromaniello/ot.js-demo). This works mostly like the ot.js-demo but support multiple documents. When you open localhost:3000 and connect with your username you will be editing a document call ```index```. You can also navigate to localhost:3000/doc/whatever to edit whatever document.

Documents are not persisted in this demo and server is disposed when the last socket disconnects.

There is a live version of this demo [here](http://obscure-lake-6538.herokuapp.com/).