_connectYjs(room) {
    console.log('connecting to ' + room);

    const doc = new Y.Doc()
    const wsProvider = new WebsocketProvider(this.server, room, doc)

    wsProvider.on('status', event => {
      console.log(event.status) // logs "connected" or "disconnected"
    });

    wsProvider.on('sync', event => {
      // initialize global state
      const globalStateMap = doc.getMap('globalState');
      globalStateMap.observe(this._observeGlobalState.bind(this));
      this._globalState = globalStateMap;
      this._globalStateChanged(globalStateMap);

      // initialize shared state map
      const sharedStatesMap = doc.getMap('sharedStates');
      this._sharedStates = sharedStatesMap;
      this._bindChildrenSharedStates();
    });
  }
/**
   * Connects to the specified Yjs room.
   *
   * @private
   */
Connects to the specified Yjs room.
@private
Connects to the specified Yjs room . @private
_connectYjs(room) {
    console.log('connecting to ' + room);
    const doc = new Y.Doc()
    const wsProvider = new WebsocketProvider(this.server, room, doc)
    wsProvider.on('status', event => {
      console.log(event.status) 
    });
    wsProvider.on('sync', event => {
      const globalStateMap = doc.getMap('globalState');
      globalStateMap.observe(this._observeGlobalState.bind(this));
      this._globalState = globalStateMap;
      this._globalStateChanged(globalStateMap);
      const sharedStatesMap = doc.getMap('sharedStates');
      this._sharedStates = sharedStatesMap;
      this._bindChildrenSharedStates();
    });
  }
_connectYjs ( room ) { console . log ( 'connecting to ' + room ) ; const doc = new Y . Doc ( ) const wsProvider = new WebsocketProvider ( this . server , room , doc ) wsProvider . on ( 'status' , event => { console . log ( event . status ) } ) ; wsProvider . on ( 'sync' , event => { const globalStateMap = doc . getMap ( 'globalState' ) ; globalStateMap . observe ( this . _observeGlobalState . bind ( this ) ) ; this . _globalState = globalStateMap ; this . _globalStateChanged ( globalStateMap ) ; const sharedStatesMap = doc . getMap ( 'sharedStates' ) ; this . _sharedStates = sharedStatesMap ; this . _bindChildrenSharedStates ( ) ; } ) ; }
Connects to the specified Yjs room.
Connects to the specified Yjs room .
// logs "connected" or "disconnected" // initialize global state // initialize shared state map