I'm looking for a way to handle the duplicated messages I got when I emit a message with this code, any idea?