This combines Electron Quick Start with Realtime Communication with WebRTC Signal Server from Codelabs with Simple Peer.
It runs a Socket.io signal server, then a peer connection over webRTC using Simple Peer between Electron and the browser. Electron serves the signal server. This currently runs over localhost on port 3000.
For Mac OS use master branch or binaryexample branch. For Windows, use binaryexample branch only. Windows 10 does not allow for two apps to simultaniously use the webcam, so the master branch getUserMedia example will not work.
To clone and run this repository you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:
# Clone this repository
git clone https://github.com/lisajamhoury/Electron-to-Browser-Simple-Peer-Example
# Go into the Electron application folder
cd Electron-to-Browser-Simple-Peer-Example/electron_app
# Install dependencies
npm install
# Run the Electron app — this will start the signaling server in Electron
npm start
# In a new command line window, go into the client folder
cd Electron-to-Browser-Simple-Peer-Example/browser_client
# Install dependencies
npm install
# Run a simple python server on your localhost
# If python 2
python -m SimpleHTTPServer 8000
# If python 3
python -m http.server 8000
# To make changes to client, run watchify in separate command line window
npm run watch
Open http://localhost:8000/dist in your browser. Open the developer console (option+command+I) to see communication between Electron and browser client.