Giter Site home page Giter Site logo

p2pchat's Introduction

P2PChat

Modern art P2PChat is a WebRTC utilizing webapp that is able to form mesh-like and SFU-like connections with other clients to transfer data between them.

Features

  • Rooms
  • Messaging
  • Creation of video/voice calls
  • Screensharing
  • Transfer of files

How to use it?

  1. Download both P2PChat and P2PChat-server projects
  2. Copy default_config.ts to config.ts and change it to your liking
  3. Pray to God that your network is not NATed or get a working TURN server
  4. Download all the required modules (with yarn install unless you enjoy a dependency hell)
  5. Build P2PChat ( npm run build/yarn build/etc. )
  6. Build P2PChat-server ( npm run build/yarn build/etc. )
  7. Copy P2PChat/build/* to P2PChat-server/build/app/views
  8. Run P2PChat-server ( npm start/yarn start/etc. )
  9. Open whatever hostname and port was set in browser

How does it work?

Data communication is done over WebRTC (with simple peer) and the webserver is used to keep a record of active rooms aswell as to signal events (with socket.io) like a user joining or leaving.
Said signaling is also used to establish WebRTC connections between users by using the server to passthrough signal messages User-server-user image

What room type to use?

When creating a room a choice will be given - Mesh type of SFU type

Mesh:

Image of a mesh architecture

  • Every single client is connected to every other client
  • If the creator of the room leaves everyone else can still communicate
  • Sometimes more reliable
  • Connected users use more resources on average than they would on SFU
  • Will face problems if too many clients connect

SFU server:

Image of a SFU architecture

  • Every client is connected to the creator of the room
  • If the creator of the room leaves everyone else cannot communicate - the room becomes "dead"
  • More resource easy on the connected clients
  • The creator of the room will need to provide all streams and process them and so will face the highest load.
  • Allows for more users than a Mesh-type would

After the room is established other users will be able to connect to it.

Problems with connection

If no STUN server is provided the connection will not be established since that is how WebRTC works*

However if no TURN server is provided some clients will still be able to connect to one another. If one cannot it is most likely due to firewall settings/ being in a NATed network. User-server-user image

To fix this issue NAT traversal can be used (and this requires a TURN server) User-server-user image

Are there any unit tests?

No

What about usable documentation?

No

And can a browser tab really be made to be a SFU server?

Probably...

Does this project use "SFU" correctly?

Nope
The SFUServer class does not implement a lot of things to follow the definition of an "SFU server" (to my knowledge) but I think that it is close enough and im not renaming all instances of SFU to something else

p2pchat's People

Contributors

miksme avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.