Skip to content
An implementation of the Google Wave Gadget API using Node and websockets
Find file
New pull request
Failed to load latest commit information.
client removed Wookie-specific code from generic client js
lib Updated to work with v0.7+
.npmignore Packaged the code to install easily with npm, and updated the doc and…
LICENSE first commit Updated to use 0.9.5 and use express hosted client in examples
package.json Updated to use 0.9.5 and use express hosted client in examples


This is an implementation of the Google Wave Gadget API using Node.js,, and Redis.

It uses diff-match-patch to synchronize states across multiple instances: clients send patches to the server, which then propagates the patches to other clients which apply the patches to their local state model. So no matter how big the state model becomes, each update event is quite small.


Install Wave using NPM with:

$ npm install wave

Creating a Wave server

To create a Wave server instance, attach it to a http server instance as follows:

var server = http.createServer(function(req, res){ 
  res.writeHead(200, {'Content-Type': 'text/html'}); 
  res.end('<h1>Wave Gadget API Server</h1>');   
var wave = require('wave').Server;
server.listen(8000, "");

Note that you must have Redis running.

Setting Redis options

You can set various options for redis by passing a map of options to the attach() method, e.g.:

wave.attach(server, {"host":"", "port":"6379", "clear":true});

The "clear" option, when set true, clears out all existing states. Other valid options are "host", "port", and any standard Redis configuration options you can pass to node_redis using redis.createClient(). See node-redis for more information.

Running the examples

To run the examples, you need to start your Redis server, and start a new Wave server using:

$ node examples/server/server.js

You can then run the examples by opening examples/index.htm in a browser and following the instructions on the page.

Client API

Each page or widget wanting to use the service needs to import the following JavaScript files:


These can all be found in the "client" folder; you can also load the current client from the server itself (e.g. http://localhost:8081/

In addition you need to call the following methods in your own scripts after importing the wave.js library:

wave.setSharedDataKey(key) : this is the "context identifier" for the pages/widgets that will share state.
wave.setViewer(id, name, icon src) : this is the current user's information

For example:


When both have been set, your page/widget will handshake with the server.

You can then use the Wave Gadget API as described at:


Note that private states are not supported yet, nor are getHost() or state.clear().

Something went wrong with that request. Please try again.