|
@@ -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]) {
|