Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
109 lines (78 sloc) 2.63 KB

Weasel - a command based websocket application framework on node.js

Weasel provides a command based websocket application framework for real-time applications like chats, games and other high performance server/client problems.

  • supports for a variety of transports (websockets, flashsockets, XHR Polling) with the help from
  • simple command based communication between server and client.
  • javascript on server and client side
  • integrated document based database mongodb


  • Node v0.1.94+

How to install

IMPORTANT! When checking out the git repo, make sure to include the submodules. One way to do it is:

git clone git://

Another, once cloned

cd Weasel
git submodule update --init --recursive

How to run the demo

cd tests
sudo node server.js

and point your browser to http://localhost:8080. In addition to 8080, if the transport flashsocket is enabled, a server will be initialized to listen to requests on the port 843.

How to use weasel


var weasel = require('../lib/weasel.server');

var Example = new weasel.Server().listen(8080);


Controller('User', {

	 * a simple chat command
	 * Can be called from the client with 'user/chat'
	 * @param	{Server}	server	the weasel server instance
	 * @param	{Client}	client	the current client who request this command
	 * @param	{Object}	requested params eg. params.message
	chat: function(server, client, params) {
		 * clientArray is a array of client who get the response
		 * responseParams are the response params
		 * this.response(clientArray, responseParams)
			message: params.message;

/app/public/index.html <script type="text/javascript" src="/server/vendor/"> </script> <script type="text/javascript" src="/server/weasel.client.js"> </script>

		Weasel.subscribe('user/chat', function(params){
			console.log('Called by another conected client:' +params.message);
		Weasel.ready(function() {
			Weasel.command('user/chat', {message: 'test'}, function(params) {


  • add unit tests
  • add a access log (http and websocket calls)
  • add command line options to weasel (like node server.js start/restart)
  • add 'run as daemon'
  • add configuration files