src/networking/Communication.js
/*
   * Request the instances that are currently running.
   * Also start listening for the different instance changes.
   * @param instanceListener listener for the different instance changes.
   */
Request the instances that are currently running.
Also start listening for the different instance changes.
@param instanceListener listener for the different instance changes.
Request the instances that are currently running . Also start listening for the different instance changes . @param instanceListener listener for the different instance changes .
requestInstances(instanceListener) {
    this.getInstances(instanceListener);
    this.client.event.subscribe(`${this.serviceName}/playerAdded`, data => {
      instanceListener.onPlayerAdded(data.playerName, data.instanceName);
    });
    this.client.event.subscribe(`${this.serviceName}/playerRemoved`, data => {
      instanceListener.onPlayerRemoved(data.playerName, data.instanceName);
    });
    this.client.event.subscribe(`${this.serviceName}/instanceCreated`, data => {
      instanceListener.onInstanceCreated(data.name, data.maxPlayers, data.gamemode, data.buttons);
    });
    this.client.event.subscribe(`${this.serviceName}/instanceRemoved`, data => {
      instanceListener.onInstanceRemoved(data.name);
    });
  }
requestInstances ( instanceListener ) { this . getInstances ( instanceListener ) ; this . client . event . subscribe ( ` ${ this . serviceName } ` , data => { instanceListener . onPlayerAdded ( data . playerName , data . instanceName ) ; } ) ; this . client . event . subscribe ( ` ${ this . serviceName } ` , data => { instanceListener . onPlayerRemoved ( data . playerName , data . instanceName ) ; } ) ; this . client . event . subscribe ( ` ${ this . serviceName } ` , data => { instanceListener . onInstanceCreated ( data . name , data . maxPlayers , data . gamemode , data . buttons ) ; } ) ; this . client . event . subscribe ( ` ${ this . serviceName } ` , data => { instanceListener . onInstanceRemoved ( data . name ) ; } ) ; }
Request the instances that are currently running.
Request the instances that are currently running .