Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rasjonell/p2p-chat
WebRTC Peer-to-Peer Video Chat
https://github.com/rasjonell/p2p-chat
p2p p2p-chat video-chat
Last synced: 1 day ago
JSON representation
WebRTC Peer-to-Peer Video Chat
- Host: GitHub
- URL: https://github.com/rasjonell/p2p-chat
- Owner: rasjonell
- Created: 2022-07-14T14:19:41.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-14T16:07:39.000Z (over 2 years ago)
- Last Synced: 2023-03-06T03:29:30.396Z (almost 2 years ago)
- Topics: p2p, p2p-chat, video-chat
- Language: TypeScript
- Homepage: https://rasjonell-p2p.netlify.app
- Size: 461 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```sh
$ npm install peer -g
```Then run it locally:
```sh
$ peerjs --port 9000 --key peerjs --path /myappStarted PeerServer on ::, port: 9000, path: /myapp (v. 0.3.2)
```Then you need to change the `PeerContext` connection in `contexts/peers/index.tsx`:
```diff
- 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:
```sh
openssl req -x509 -newkey rsa:2048 -keyout keytmp.pem -out cert.pem -days 365
```Then:
```sh
openssl rsa -in keytmp.pem -out key.pem
```Finally, change the `start` script in `package.json`:
```diff
- "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