fix number of connected users

This commit is contained in:
Hans Pagel 2020-09-26 14:37:35 +02:00
parent 81051835f4
commit 225727e40f

View File

@ -36,15 +36,15 @@ export default {
},
mounted() {
const name = 'example'
const documentName = 'example'
this.ydoc = new Y.Doc()
this.provider = new WebrtcProvider(name, this.ydoc)
this.provider = new WebrtcProvider(documentName, this.ydoc)
this.type = this.ydoc.getXmlFragment('prosemirror')
this.indexdb = new IndexeddbPersistence(name, this.ydoc)
this.indexdb = new IndexeddbPersistence(documentName, this.ydoc)
this.provider.on('peers', ({ bcPeers, webrtcPeers }) => {
this.numberOfConnectedUsers = bcPeers.length + webrtcPeers.length
this.provider.on('peers', ({ webrtcPeers }) => {
this.numberOfConnectedUsers = webrtcPeers.length
})
this.editor = new Editor({