yjs / y-indexeddb

IndexedDB database adapter for Yjs
https://docs.yjs.dev/ecosystem/database-provider/y-indexeddb
Other
196 stars 30 forks source link

Can we use IPFS Connector? #6

Closed harrshasri closed 6 years ago

harrshasri commented 6 years ago

Can we use IPFS Connector?

dmonad commented 6 years ago

Please reopen a new issue with more details to your question. What does this have to do with y-indexeddb?

harrshasri commented 6 years ago

Can I use ipfs-connector with y-indexeddb As you didn't mention in the example. I thought it could be only used with websockets-client.


Y({
  db: {
    name: 'indexeddb'
  },
  connector: {

name:'ipfs',

name: 'websockets-client', // choose the websockets connector
// name: 'webrtc'
// name: 'xmpp'
room: 'Textarea-example-dev'
},
sourceDir: '/bower_components', // location of the y-* modules
share: {
textarea: 'Text' // y.share.textarea is of type Y.Text
}
// types: ['Richtext', 'Array'] // optional list of types you want to import
}).then(function (y) {
// bind the textarea to a shared text element
y.share.textarea.bind(document.getElementById('textfield'))
}
dmonad commented 6 years ago

The connector interface is completely decoupled from the database adapter. So yes, you can use y-ipfs + y-indexeddb. This is by the way how peerpad works.

harrshasri commented 6 years ago

Thanks @dmonad

dmonad commented 6 years ago

Welcome!