Giter Club home page Giter Club logo

friends-swarm's Introduction

friends-swarm

npm travis

๐Ÿ webrtc-swarm with friends

Install

npm install friends-swarm

Usage

var friendsSwarm = require('friends-swarm')

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

ISC

friends-swarm's People

Contributors

feross avatar max-mapper avatar flet avatar mafintosh avatar beaugunderson avatar adjective-object avatar ungoldman avatar

Stargazers

 avatar Jez avatar  avatar  avatar Usama Abid avatar Haroldo de Oliveira Pinheiro avatar varHarrie avatar Pavel Kuznetsov avatar Erik Vavro avatar Curtis avatar Saad Shahd avatar Joseph Werle avatar Gilles De Mey avatar DK Dhilip avatar Ben Lawson avatar Alexandre Nicastro avatar  avatar trashman avatar Helder S Ribeiro avatar Adrian van Dongen avatar Steve Phillips avatar Fabio Dias Rollo avatar Aster Haven avatar Daniel Georgiev avatar Athan avatar  avatar valery sntx avatar TJ Krusinski avatar JT5D avatar Yosh avatar Kyle Robinson Young avatar  avatar

Watchers

 avatar  avatar Bret Comnes avatar  avatar  avatar  avatar Kira Oakley avatar James Cloos avatar Calvin Metcalf avatar Martin Ek avatar

friends-swarm's Issues

Swap out hyperlog for hypercore: selective replication

This is a non-trivial change, but eventually it'd be great to see Friends using hypercore.

It offers one particular "killer feature" that'd be of great use to Friends, which is selective replication. Hyperlog forces complete replication of a data set, which, for chat, is almost never desirable: you don't want to download 100% of a channel's chat history when you join; you want just the last N messages. Hypercore provides this while still keeping the crypto guarantees on data integrity.

The big caveat is that hypercore doesn't handle many cross-referencing append-only logs like hyperlog does. A great module for someone to build out would be hyperlog-hypercore or hyperlog2: a module that provides hyperlog's API, but is powered by hypercore underneath.

Peer network

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?

friends-swarm/swarm.js

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?

Pass in signalhub URLs as an option

We should add an option when creating a friends-swarm to override the official friends signalhubs.

Should we remove the hardcoded signalhubs altogether and modify friends to pass in its hubs?

friends-swarm -> friends-db + friends-swarm

It'd be helpful to see the core p2p database part of this module broken out into its own module, with friends-swarm layered on top. friends-db then could just expose db ops and generic replication streams that would allow for additional, non-webrtc transports too.

have a demo?

the code :
"var friendsSwarm = require('friends-swarm')" is
too simple, please show us full example so that we can understand it .

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.