A simple peer-to-peer chat app by Sienna M. Wood.
- Requirements:
- Install and run:
# clone repository git clone https://github.com/siennamw/simple-chat.git cd simple-chat # install dependencies yarn # start development server yarn start
- Open http://localhost:3000 in a browser to view the running app. A peer-to-peer session will be created automatically for this user, making it ready for additional users to join.
- Click the link to join the chat and a second tab will open. The two will be automatically connected in a peer-to-peer session. Additional users can join the session in the same way.
- Switch between the tabs to send chat messages between them.
To run all tests once:
yarn test --watchAll=false
- PeerJS, the library being used to establish peer-to-peer connections, uses WebRTC. Support for WebRTC is improving rapidly, but still has some limitations.
- To broker peer-to-peer connections, PeerJS provides a free cloud-hosted PeerServer, which this project uses. In a production environment, it might be preferable to run our own PeerServer to have more control and transparency over this process.
- Currently there are no hard limits on the number of peers that can connect to each other. There are certainly practical limits, however, and I would expect more and more bugs and performance issues as the number of peers increases.
- Using peer-to-peer connections means that there is no way to capture or monitor chat content. This may not be desirable, depending on business needs.
- Currently there are no tests for
peer.service.js
, which is a critical component of the app. This is because the test setup bundled in create-react-app is geared towards testing React components and user interactions with the UI, so it will take some time to sort out leveraging this system to test the peer-to-peer service.