He greeted the Messenger of Allah (ﷺ) with the Salam when he was praying, and he returned the greeting.
Sunan an-Nasa'i Book 13, Hadith 10