SOURCE -> PEER

This commit is contained in:
Michelle Bu 2013-01-20 15:46:01 -08:00
parent 1c5b22c93c
commit 6475fa0c37
2 changed files with 6 additions and 14 deletions

View File

@ -37,19 +37,8 @@ function PeerServer(options) {
switch (message.type) {
// Source connected -- send back its ID.
case 'SOURCE':
socket.send(JSON.stringify({ type: 'SOURCE-ID', id: clientId }));
break;
// Sink connected -- send back its ID and notify src.
case 'SINK':
if (!!message.source && !!self.clients[message.source]) {
self.clients[message.source].send(JSON.stringify({
type: 'SINK-CONNECTED', sink: clientId }));
socket.send(JSON.stringify({ type: 'SINK-ID', id: clientId }));
} else {
util.prettyError('source invalid');
}
case 'PEER':
socket.send(JSON.stringify({ type: 'ID', id: clientId }));
break;
case 'LEAVE':
if (!!self.clients[message.dst]) {

View File

@ -7,7 +7,10 @@
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"repository": "",
"repository": {
"type": "git",
"url": "git://github.com/michellebu/peerjs-server.git"
},
"author": "Michelle Bu",
"license": "BSD",
"dependencies": {