Abstract: (IOP)Advanced LIGO’s second observing run (O2), conducted from 2016 November 30 to 2017 August 25, combined with Advanced Virgo’s first observations in 2017 August, witnessed the birth of gravitational-wave multimessenger astronomy. The first ever gravitational-wave detection from the coalescence of two neutron stars, GW170817, and its gamma-ray counterpart, GRB 170817A, led to an electromagnetic follow-up of the event at an unprecedented scale. Several teams from across the world searched for EM/neutrino counterparts to GW170817, paving the way for the discovery of optical, X-ray, and radio counterparts. In this article, we describe the online identification of gravitational-wave transients and the distribution of gravitational-wave alerts by the LIGO and Virgo collaborations during O2. We also describe the gravitational-wave observables that were sent in the alerts to enable searches for their counterparts. Finally, we give an overview of the online candidate alerts shared with observing partners during O2. Alerts were issued for 14 candidates, 6 of which have been confirmed as gravitational-wave events associated with the merger of black holes or neutron stars. Of the 14 alerts, 8 were issued less than an hour after data acquisition.