https://github.com/lostsource/simplertcdata
Browser-to-Browser Messaging Simplified
https://github.com/lostsource/simplertcdata
Last synced: about 1 month ago
JSON representation
Browser-to-Browser Messaging Simplified
- Host: GitHub
- URL: https://github.com/lostsource/simplertcdata
- Owner: lostsource
- License: mit
- Created: 2015-04-05T15:05:26.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-05T17:11:27.000Z (almost 8 years ago)
- Last Synced: 2025-04-07T14:46:57.953Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 378 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [](#)
SimpleRTCData is a tiny JavaScript library which can be used to establish an RTCDataChannel between two peers. It does not handle relaying of messages during connection setup so a separate signalling mechanism is required.
- [How it works](#how-it-works)
- [Basic Usage](#basic-usage)
- [Constructor](#constructor)
- [Methods](#methods)
- [close](#close)
- [getAnswer](#getanswer)
- [getConnection](#getconnection)
- [getDataChannel](#getdatachannel)
- [getOffer](#getoffer)
- [request](#request)
- [send](#send)
- [setAnswer](#setanswer)
- [Events](#events)
- [on('connect')](#onconnect)
- [on('data')](#ondata)
- [on('disconnect')](#ondisconnect)
- [on('request')](#onrequest)
- [onChannelEvent](#onchannelevent)
- [onConnectionEvent](#onconnectionevent)## How it works
1. Peer A calls `getOffer` and sends the offer to Peer B
2. Peer B calls `getAnswer` and sends the answer to Peer A
3. Peer A calls `setAnswer` using the answer received from Peer B*You may want to go through these steps using this [online example](https://lostsource.github.io/SimpleRTCData/)*
[](https://lostsource.github.io/SimpleRTCData/)
## Basic Usage
Start by including the library in your markup,