If the user is registered with verified email, it'd be nice to send to notify him when someone writes to him.
It could probably be done with a cloud function with firestore trigger.
It's a bit more complicated - we shouldn't email after every direct message as it's like chat thus encouraging sending more than one message - instead it'd be better to notify (1) about a new group of messages and (2) after they're not read for some time or if we detect user is not online.
We can't detect whether or not the user is online yet.
If he's online and new message is sent, unread-message indicator appears on his profile icon.
If the user is registered with verified email, it'd be nice to send to notify him when someone writes to him.
It could probably be done with a cloud function with firestore trigger.
It's a bit more complicated - we shouldn't email after every direct message as it's like chat thus encouraging sending more than one message - instead it'd be better to notify (1) about a new group of messages and (2) after they're not read for some time or if we detect user is not online.
We can't detect whether or not the user is online yet. If he's online and new message is sent, unread-message indicator appears on his profile icon.