Marron: A Firefox Extension for Peer-to-Peer Webapps

By Travis Fischer and Tim O'Donnell

Marron is an extension for Firefox that allows the clients using a web application to pass messages to each other, without server involvement. It was written to investigate the plausability of peer-to-peer web applications.

What's this good for? Allowing the client code of a webapp to talk directly to other client code without using the server has some interesting implications, including:

Brief Documentation

Install the extension and include marron.js in your webapp's JS. This creates a window.Marron wrapper object that exposes the Marron extension's functionality in a convenient API. If for some reason you'd like to use the extension directly, take a look at the window.marron object the extension exposes.

The window.Marron.register(lambda) function registers a user-provided (object -> void) JS function, lambda, to be called when a message is sent to the newly-created local Marron server, with the contents of the message as its parameter. register() returns a string containing the URL that other clients can pass to window.Marron.send() to send such a message. For example,

var receiveFunction = function (message) {
  alert("Received: " + message);
}
var url = window.Marron.register(receiveFunction);
then url would be a string like marron://clavier:6957/bgRPsM4D.

The window.Marron.send(ur, object) function sends a message to the Marron server running at the given url. The message contents are an arbitrary JS object, object. Since object is JSON-encoded for transfer, functions are not automatically preserved across the wire. Take a look at Function:toString if you need to send objects containing functions. send() returns true if the message was successfully sent (which does not assure receipt), and false if a problem occurred while sending.

Let's continue the above example and append the following code:

window.Marron.send(url, "hello");

Executing this will cause an alert box to appear with the string "Received: hello".

Download

Marron is Free software licensed under the GPL.

To install Marron, download the Marron Extension.

To hack Marron, download the code.