Skip to content

Instantly share code, notes, and snippets.

@allthetime
Created May 23, 2015 06:48
Show Gist options
  • Save allthetime/24596060d8a1697bc29d to your computer and use it in GitHub Desktop.
Save allthetime/24596060d8a1697bc29d to your computer and use it in GitHub Desktop.
var PeerServer = require('peer').PeerServer;
var server = new PeerServer({port: 9000, path: '/myapp'});
var request = require('request');
console.log("peer server listening on 9000")
server.on('connection', function(id) {
console.log("connected: " + id)
});
server.on('disconnect', function(id) {
console.log('disconnected:' + id);
request.del('http://allthetime.io/rtos/rooms?userName='+id);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment