  Space-borne gravitational wave (GW) detectors can detect the merger of
massive black holes. The early warning and localization of GW events before
merging can be used to inform electromagnetic telescopes and conduct
multimessenger observations. However, this requires real-time data transmission
and analysis capabilities. The geocentric orbit of the space-borne GW detector
TianQin makes it possible to conduct real-time data transmission. In this
study, we develop a search and localization pipeline for massive black hole
binaries (MBHBs) with TianQin under both regular and real-time data
transmission modes. We demonstrate that, with real-time data transmission,
MBHBs can be accurately localized on the fly. With the approaching merger, each
analysis can be finished in only 40 min. For an MBHB system at a distance of 1
Gpc, if we receive data every hour, then we can pinpoint its location to within
less than 1 deg$^2$ on the final day before the merger.
