Pyrotechnics is the science of using materials capable of undergoing self-contained and self-sustained exothermic chemical reactions for the production of heat, light, gas, smoke and/or sound.
Used under extreme emergency situations (such as distress), these are provided onboard ships to grab the attention/inform ships within range so as to seek help and assistance of the vessels for rescue. Basically, it is a visual method of sending SOS signals. These pyrotechnics are used in time of distress is mentioned in Annex 4 of COLREGs.