-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
41 lines (37 loc) · 934 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var PouchDB = require('pouchdb');
var server = require('socket-pouch/server');
var client = require('socket-pouch/client');
PouchDB.adapter('socket', client);
server.listen(
5000,
{
pouchCreator: function(dbName) {
return new PouchDB(dbName, {
db: require('leveldown'),
});
},
},
() => {
console.log('Hiiii!');
}
);
// let local = new PouchDB('testa');
// setTimeout(function() {
// let remote = new PouchDB({
// adapter: 'socket',
// name: 'testa',
// url: 'ws://192.168.43.230:5000',
// });
// local
// .sync(remote, { live: true, retry: true })
// .on('change', info => console.log('Info: ', info.docs))
// .on('error', err => console.log('Error: ', err));
// }, 5000);
// setInterval(() => {
// local
// .allDocs({
// include_docs: true,
// })
// .then(docs => console.log(docs))
// .catch(err => console.log(err));
// }, 10000);