Skip to content
podefr edited this page May 7, 2012 · 6 revisions

You need to npm install olives to be able to use it. See the installation chapter.

Transport wraps socket.io to simulate two ways of doing requests to your node.js server.

Transport works the same as Emily's Transport, its has the same interfaces. But you need to use this one in the browser.

Creating Transport

// This assumes you have loaded socket.io in your web browser. See socket.io's documentation.
// io is an instance of socket.io
// href it the address of the node.js server
var transport = new Transport(io, href);

When transport is created you can make request. It works exactly the same way as Emily's.

###Configuring olives on the server side

var olives = require("olives");

// Registering your instance of socket.io
olives.registerSocketIO(io);

###Adding your own handlers

You can find more info about handlers in Emily's documentation.

olives.handlers.set("addYouHandlerHere", function () {});