All Projects → coast-team → Netflux

coast-team / Netflux

Licence: agpl-3.0
JavaScript client and server side transport API based on WebRTC & WebSocket

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Netflux

Wt Tracker
High-performance WebTorrent tracker
Stars: ✭ 144 (-23.4%)
Mutual labels:  webrtc, p2p, websockets
Pychat
webchat via WebSockets/WebRTC that allows messaging/video call/screen sharing
Stars: ✭ 152 (-19.15%)
Mutual labels:  webrtc, websockets
Metastream
Watch streaming media with friends.
Stars: ✭ 1,926 (+924.47%)
Mutual labels:  webrtc, p2p
Webrtc Qr
WebRTC Connect Experiment - https://aquigorka.com/webrtc-qr/
Stars: ✭ 154 (-18.09%)
Mutual labels:  webrtc, p2p
Roll Call
📞 Free and reliable audio calls for everyone w/ browser p2p.
Stars: ✭ 1,563 (+731.38%)
Mutual labels:  webrtc, p2p
Wave Share
Serverless, peer-to-peer, local file sharing through sound
Stars: ✭ 1,641 (+772.87%)
Mutual labels:  webrtc, p2p
Meshenger Android
P2P Audio/Video calls over local networks. No server or Internet access needed.
Stars: ✭ 152 (-19.15%)
Mutual labels:  webrtc, p2p
Pikachu Volleyball P2p Online
Pikachu Volleyball peer-to-peer online via WebRTC data channels
Stars: ✭ 160 (-14.89%)
Mutual labels:  webrtc, p2p
P2pt
Simple WebRTC Peer 2 Peer connections using WebTorrent trackers as the signalling server. Use WebTorrent trackers for any kind of WebRTC app ! 🔥 Make WebRTC apps fast & easy ! 🚀⭐
Stars: ✭ 159 (-15.43%)
Mutual labels:  webrtc, p2p
P2p Cdn Sdk Javascript
Free p2p cdn github javascript sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 158 (-15.96%)
Mutual labels:  webrtc, p2p
U2web
stream video with p2p
Stars: ✭ 97 (-48.4%)
Mutual labels:  webrtc, p2p
Peardownloader.js
一个支持多协议、多源、混合P2P-CDN的下载器
Stars: ✭ 170 (-9.57%)
Mutual labels:  webrtc, p2p
Peerjs
Simple peer-to-peer with WebRTC
Stars: ✭ 9,888 (+5159.57%)
Mutual labels:  webrtc, p2p
Hublin
DEPRECATED - An easy and free video conference service based on WebRTC
Stars: ✭ 1,614 (+758.51%)
Mutual labels:  webrtc, p2p
Libcrtc
WebRTC C++ library built on top of chromium webrtc.
Stars: ✭ 89 (-52.66%)
Mutual labels:  webrtc, p2p
Camus
Peer-to-peer group video chat using WebRTC, Python, and Javascript
Stars: ✭ 75 (-60.11%)
Mutual labels:  webrtc, p2p
Ca11
Multi-Protocol Webphone
Stars: ✭ 69 (-63.3%)
Mutual labels:  webrtc, p2p
Android P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 70 (-62.77%)
Mutual labels:  webrtc, p2p
Kalm.js
The socket manager
Stars: ✭ 155 (-17.55%)
Mutual labels:  webrtc, websockets
Spitfire
An easy to use WebRTC Datachannels library for .NET applications.
Stars: ✭ 164 (-12.77%)
Mutual labels:  webrtc, p2p

Netflux

Netflux logo

Isomorphic Javascript peer to peer transport API for client and server.

Secure and fault tolerant full mesh peer to peer network based on RTCDataChannel and WebSocket.

Send/receive String and Uint8Array data types.

Documentation: https://coast-team.github.io/netflux

version travis

codeclimate Test Coverage documentation

Conventional Changelog semantic-release gitter

Netflux example

Features

  • Peer to peer full mesh network tolerant to connection failures.
  • Same API for clients (Chrome, Firefox) and servers (NodeJS).
  • Send private or broadcast messages with String, Uint8Array data types.
  • Send large amounts of data (over the limit of ~16kb used in RTCDataChannel).
  • Automatic rejoin the group when connection lost.
  • Hide the connection nature ( WebSocket or RTCDataChannel) from API consumer.
  • All connections are encrypted.
  • Full control over WebRTC servers: Signaling, STUN and TURN.
    • Deploy your own Signaling server (Sigver) or use the one provided by default.
    • Configure STUN and TURN servers.
  • Small Signaling server payload.
  • Signaling server is only used to establish connection between two peers, no user data is passing through it.
  • TypeScript declaration files are included.
  • Simple and familiar API usage.
  • Multiple bundles to suit your workflow:
    • For NodeJS
      • dist/netflux.node.es5.cjs.js commonjs format, es5 code (see package.json#main).
      • dist/netflux.node.es5.esm.js ES module format, es5 code (see package.json#module).
    • For browsers
      • dist/netflux.browser.es5.umd.js UMD format, es5 code
      • dist/netflux.browser.es5.esm.js ES module format, es5 code (see package.json#browser).
      • dist/netflux.browser.es2015.esm.js ES module format, es2015 code (see package.json#es2015).
      • dist/netflux.browser.esnext.esm.js ES module format, esnext code (see package.json#esnext).

Install

npm install netflux

3 peer dependencies to be installed in some cases:

  • rxjs is necessary for both NodeJS and browsers if you want to take advantage of EcmaScript modules, tree-shaking etc. Otherwise it is already included into dist/netflux.browser.es5.umd.js and dist/netflux.node.es5.cjs.js bundles.
npm install rxjs
  • uws and text-encoding if you target NodeJS (developing a bot):
npm install uws text-encoding

Why peer dependencies?

  • Reduce the installation size by omitting unused dependencies.
  • Take advantage of new standards and techniques: EcmaScript modules, bundle tools like Webpack, Rollup etc.

Usage

Here is a basic usage example for client and server (checkout the documenation for more details).

Bot server is not mandatory. The group may completely be composed of clients only, as well as be composed of servers only or may also be mixed.

Client example

import { WebGroup, WebGroupState } from 'netflux'

// Create instance and set callbacks
const wg = new WebGroup()

wg.onMemberJoin = (id) => {
  console.log(`Member ${id} has joined. Current members list is: `, wg.members)
  // Say hello to the new peer
  wg.sendTo(id, 'Hello, my name is Bob')
}

wg.onMemberLeave = (id) => {
  console.log(`Member ${id} has left. Remained members are: `, wg.members)
}

wg.onMessage = (id, data) => {
  console.log(`Message from ${id} group member`, data)
}

wg.onStateChange = (state) => {
  console.log('The new Group state is ', state)
  switch (state) {
    case WebGroupState.JOINING:
      // Do something
      break
    case WebGroupState.JOINED:
      // Do something... for example invite a bot...
      wg.invite('BOT_SERVER_WEB_SOCKET_URL')
      // Or send message to all peers
      wg.send('Hello everybody. I have just joined the group.')
      break
    case WebGroupState.LEFT:
      // wg.key === ''
      // wg.id === 0
      // wg.myId === 0
      // wg.members === []
      // the current wg object is at the same state as if it was instantiated via new WebGroup(...), hence
      // it can be reused to join another group for example.
      // Do something...
      break
  }
}

// Join the group
wg.join('MY_UNIQUE_KEY_FOR_THE_GROUP')

Bot example

import { Bot, WebGroupState } from 'netflux'
const http = require('http') // https is also possible
const server = http.createServer()

const bot = new Bot({
  server: server,
  webGroupOptions: {
    // Any WebGroup options like for a client
  },
})

bot.onWebGroup = (wg) => {
  console.log('The current state is JOINING: ', wg.state === WebGroupState.JOINING)
  // New instance of a WebGroup (Someone has invited this bot).
  // See example above for client as it is the same API.
}

server.listen(BOT_PORT, _BOT_HOST)
// A client may invite this bot with the following URL: 'ws://BOT_HOST:BOT_PORT'

Demo

Netflux used as a transport layer for Multi User Text Editor (MUTE repo) developed by our team. The demo version is available on: https://coedit.re.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].