code: function() {
              self._client.roomState(roomId).then(function(events) {
                  events.forEach(function(ev) {
                      if (self._eventTypes[ev.type]) {
                          if (!r.events[ev.type]) {
                              r.events[ev.type] = {};
                          }
                          r.events[ev.type][ev.state_key] = ev;
                      }
                  });
                  resolve(r);
              }, function(err) {
                  if (err.httpStatus >= 400 && err.httpStatus < 600) { // 4xx, 5xx
                      reject(err); // don't have permission, don't retry.
                  }
                  // wait a bit then try again
                  Promise.delay(3000).then(function() {
                      if (!self._dict[roomId]) {
                          return;
                      }
  
                      queryRoomState();
                  });
              });
          }
docs: convoluted query function so we can do retries on errors