GithubHelp home page GithubHelp logo

rasjonell / p2p-chat Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 472 KB

WebRTC Peer-to-Peer Video Chat

Home Page: https://rasjonell-p2p.netlify.app

HTML 19.58% CSS 29.70% TypeScript 50.71%
p2p p2p-chat video-chat

p2p-chat's Introduction

WebRTC P2P Video/Audio Chat

Check out the live app at https://rasjonell-p2p.netlify.app

Using a Local Peer Discovery Server

By default the app uses PeerJS cloud peer discovery server.

In order to use a local Peer Discovery Server you need to install peerjs server:

$ npm install peer -g

Then run it locally:

$ peerjs --port 9000 --key peerjs --path /myapp

  Started PeerServer on ::, port: 9000, path: /myapp (v. 0.3.2)

Then you need to change the PeerContext connection in contexts/peers/index.tsx:

- const [peer] = useState(new Peer());

+ const [peer] = useState(new Peer({ host: 'localhost', port: 9000, path: '/myapp' }));

Enabling HTTPS

In order to use MediaDevices you must have an HTTPS connection.

To enable HTTPS on the project root run:

openssl req -x509 -newkey rsa:2048 -keyout keytmp.pem -out cert.pem -days 365

Then:

openssl rsa -in keytmp.pem -out key.pem

Finally, change the start script in package.json:

- "start": "react-scripts start"
+ "start": "export HTTPS=true&&SSL_CRT_FILE=cert.pem&&SSL_KEY_FILE=key.pem react-scripts start",

Now you can run yarn start and have fun!

To Do

  • Fix call.on('close') event not being emitted
  • Enable username identification
  • Persist usernames per device

p2p-chat's People

Contributors

rasjonell avatar

Watchers

James Cloos avatar  avatar

Forkers

fetpo

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.