fix broadcast channel communication

This commit is contained in:
Kevin Jahns 2018-12-11 20:18:11 +01:00
parent 1a79e429ed
commit b6f7cd7869
2 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@
"now-start": "npm run websocket-server"
},
"files": [
"build/*",
"bindings/*",
"docs/*",
"examples/*",

View File

@ -104,8 +104,8 @@ class WebsocketsSharedDocument extends Y.Y {
setupWS(this, url)
this.on('afterTransaction', broadcastUpdate)
this._bcSubscriber = data => {
const encoder = readMessage(this, data) // already muxed
this.mux(() => {
const encoder = readMessage(this, data)
if (Y.encoding.length(encoder) > 1) {
bc.publish(url, Y.encoding.toBuffer(encoder))
}