WebRTC for the rest of us. It's a miracle.
But seriously, this is a webRTC wrapper for data packet exchange. Sending audio and video might be cool, but just sending serialized data is more useful.
- Include the library, [datafestivus.js], from this repository.
- Construct a SideBand object (
var sideband = new DataFestivus.SideBand
) and override the methodsonsave
,oncomplete
, andbegin
. Due to implementation details, there are specific requirements for each override. See github Issue #1 - Depending on whether the local code is offering or answering the connection, pass the sideband instance to
DataFestivus.start
orDataFestivus.reply
, respectively. - After the sideband's
oncomplete
is called (indicating a successful connection), useDatafestivus.send
to transmit a data object via the connection. Add an event listener function usingDatafestivus.addMessageListener
, which is called with the data object as its single argument.
begin
- See github Issue #2 - begin must differentiate offer and answer by whether sideBand.isStarted
is set to true
This project aims to create a stateless storage system on a server that can facilitate a peer-to-peer connection in WebRTC. It also implements a WebRTC app that demonstrates its usefulness. The reason for the server application is:
- WebRTC requires a 3rd party means of communication in order to establish a peer-to-peer connection.
- Every WebRTC tutorial glosses over this problem by connecting a browser window to itself via javascript variables.
- Some solutions suggest using 3rd-party services to solve the problem, such as Firebase, which are unnecessary.
- The data that needs to be transmitted is simple json; there's no need to complicate sharing it.