Skip to content

Instantly share code, notes, and snippets.

@katowulf
Created June 24, 2013 15:34
Show Gist options
  • Save katowulf/06bb918b58e02190742a to your computer and use it in GitHub Desktop.
Save katowulf/06bb918b58e02190742a to your computer and use it in GitHub Desktop.
Emulate socket.io behavior in Firefox
// the recipient of the socket.io transaction would look like this:
var fb = new Firebase('https://YOURINSTANCE.firebaseio.com');
fb.on('value', function(ss) {
// here is the data transferred from the sender!
var data = ss.val();
// if you want the data removed after it is received, then uncomment this
// ss.ref().remove();
});
// the sender would look like this
var fb = new Firebase('https://YOURINSTANCE.firebaseio.com');
function pushToRecipients(newData) {
fb.set( newData );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment