This repository was archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
This repository was archived by the owner on Jul 11, 2019. It is now read-only.
Peer network #6
Copy link
Copy link
Open
Description
Hey!
I've been thinking about how to solve the problem of a peer-to-peer group chat between a significant number of users without overloading the network: if I'm in a room with 1000 people, I don't want my browser to open 999 connections.
If I'm understanding the code correctly, does friends just open a connection to every other peer like I just described?
Lines 100 to 120 in 02bc0e1
| sw.on('peer', function (p, id) { | |
| var stream = log.replicate({live: true}) | |
| log.peers.push(p) | |
| p.on('close', function () { | |
| var i = log.peers.indexOf(p) | |
| if (i > -1) log.peers.splice(i, 1) | |
| }) | |
| swarm.emit('peer', p, name, id, stream) | |
| stream.on('push', function () { | |
| swarm.emit('push', name) | |
| }) | |
| stream.on('pull', function () { | |
| swarm.emit('pull', name) | |
| }) | |
| p.pipe(stream).pipe(p) | |
| }) |
This feels like it's going to be a super interesting problem to solve: have any of you thought about it before or know anything about the topic?
Metadata
Metadata
Assignees
Labels
No labels