Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (37 sloc) 2.26 KB


Peerbind is an event binding library that allows JavaScript-initiated interactions between website visitors.

Originally Authored by Matt Amacker!/peerbind an Engineer for This is an adaption to help people get up and running with their own endpoints or Peerbind in general.

Client side setup

Include jquery.js and jQuery.peerbind.js into your webpage:

<script src=""></script>
<script src="jQuery.peerbind.js"></script>

Bind an event to a DOM element:

  $(document).ready(function() {
    function addChat(msg) {

    $("input").peerbind("change", {
      peer:  function(e) { addChat(e.srcPeer + ": " + e.peerData);},
      local: function(e) { addChat("You: " + e.peerData); $(this).val("");}
Type a message: <input type="text"> 
<div id="chats"></div>

That's it! Have a look at the documentation for other parts of the API.

Running your own Peerbind server (endpoint)

You'll need to have node.js installed to run the Peerbind server. For installation instructions see the node.js wiki. Once you've installed node, you can run the Peerbind server with the following command:

node peerbindserver.js

This server will serve files relative from the calling directory. You can specify the public directory with the first argument after the server:

node peerbindserver.js /var/www/peerbind/
node peerbindserver.js ~/peerbind

The index.html file included in this repository has some example code to set up a simple chat app that can run over a localhost node.js server and your browser.

Something went wrong with that request. Please try again.