fix broadcast channel communication
This commit is contained in:
		
							parent
							
								
									1a79e429ed
								
							
						
					
					
						commit
						b6f7cd7869
					
				@ -18,6 +18,7 @@
 | 
				
			|||||||
    "now-start": "npm run websocket-server"
 | 
					    "now-start": "npm run websocket-server"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "files": [
 | 
					  "files": [
 | 
				
			||||||
 | 
					    "build/*",
 | 
				
			||||||
    "bindings/*",
 | 
					    "bindings/*",
 | 
				
			||||||
    "docs/*",
 | 
					    "docs/*",
 | 
				
			||||||
    "examples/*",
 | 
					    "examples/*",
 | 
				
			||||||
 | 
				
			|||||||
@ -104,8 +104,8 @@ class WebsocketsSharedDocument extends Y.Y {
 | 
				
			|||||||
    setupWS(this, url)
 | 
					    setupWS(this, url)
 | 
				
			||||||
    this.on('afterTransaction', broadcastUpdate)
 | 
					    this.on('afterTransaction', broadcastUpdate)
 | 
				
			||||||
    this._bcSubscriber = data => {
 | 
					    this._bcSubscriber = data => {
 | 
				
			||||||
 | 
					      const encoder = readMessage(this, data) // already muxed
 | 
				
			||||||
      this.mux(() => {
 | 
					      this.mux(() => {
 | 
				
			||||||
        const encoder = readMessage(this, data)
 | 
					 | 
				
			||||||
        if (Y.encoding.length(encoder) > 1) {
 | 
					        if (Y.encoding.length(encoder) > 1) {
 | 
				
			||||||
            bc.publish(url, Y.encoding.toBuffer(encoder))
 | 
					            bc.publish(url, Y.encoding.toBuffer(encoder))
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user