Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scottmtp/pouch-replicate-webrtc
Replicate a PouchDB over a WebRTC DataChannel.
https://github.com/scottmtp/pouch-replicate-webrtc
Last synced: 12 days ago
JSON representation
Replicate a PouchDB over a WebRTC DataChannel.
- Host: GitHub
- URL: https://github.com/scottmtp/pouch-replicate-webrtc
- Owner: scottmtp
- License: mit
- Created: 2015-06-14T23:37:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-11T20:38:51.000Z (about 9 years ago)
- Last Synced: 2024-11-17T10:08:05.978Z (27 days ago)
- Language: JavaScript
- Size: 559 KB
- Stars: 38
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pouch-replicate-webrtc
Replicate a PouchDB over a WebRTC DataChannel, for NodeJS and the Browser.
## About
By using a WebRTC DataChannel, we can share data between browsers without storing
the data on a centralized server.Uses [pouchdb-replication-stream](https://github.com/nolanlawson/pouchdb-replication-stream)
for replicating PouchDB data.## Install
This library can be used both on Serverside and on Clientside.
### On Serverside, using NodeJS
```
$ npm install --save pouch-replicate-webrtc
```### On Clientside
You can import the pouch-replicate-webrtc.min.js from the dist folder.
Alternatively, you can user Bower to install it:
```
$ bower install --save pouch-replicate-webrtc
```## Usage
Example using [rtc-quickconnect](https://github.com/rtc-io/rtc-quickconnect):
```
var PouchDB = require('pouchdb');
var PouchReplicator = require('pouch-replicate-webrtc');
var quickconnect = require('rtc-quickconnect');var pouchDb = new PouchDB('myDb');
var replicator = new PouchReplicator('replicator', pouchDb, {batch_size: 50});replicator.on('endpeerreplicate', function() {
console.log('received data from replication');
});quickconnect('https://switchboard.rtc.io/', { room: 'qc-simple-demo' })
.createDataChannel('replication')
.on('channel:opened:replication', function(id, dc) {
replicator.addPeer(id, dc);
replicator.replicate();
});```
## Build
### Clientside
To build the Clientside version, you will need to run:
```
npm install
npm run browserify
```## License
MIT © [Scott Dietrich](http://minutestopost.com)