code: @Override
      public void onReceive(Object message) {
          if (message instanceof UserOnline) {
              UserOnline online = (UserOnline) message;
              onUserOnline(online.getUid(), online.getUpdateDate());
          } else if (message instanceof UserOffline) {
              UserOffline offline = (UserOffline) message;
              onUserOffline(offline.getUid(), offline.getUpdateDate());
          } else if (message instanceof UserLastSeen) {
              UserLastSeen lastSeen = (UserLastSeen) message;
              onUserLastSeen(lastSeen.getUid(), lastSeen.getDate(), lastSeen.getUpdateDate());
          } else if (message instanceof GroupOnline) {
              GroupOnline groupOnline = (GroupOnline) message;
              onGroupOnline(groupOnline.getGid(), groupOnline.getCount(), groupOnline.getUpdateDate());
          } else if (message instanceof Subscribe) {
              subscribe(((Subscribe) message).getPeer());
          } else if (message instanceof SessionCreated) {
              onNewSessionCreated();
          } else if (message instanceof OnlineUserTimeout) {
              OnlineUserTimeout timeout = (OnlineUserTimeout) message;
              onUserGoesOffline(timeout.getUid(), timeout.getDate(), timeout.getUpdateDate());
          } else {
              super.onReceive(message);
          }
      }
docs: Messages