Configure Ejabberd Vitualhost

I have ejabberd version 16.01 installed in 1 node which served 2 virtual host.

Example:
vhost1.com
vhost2.com

How to configure ejabberd so that user in vhost1.com can't communicate to user in vhost2.com, and vice versa.

ejabberd does not implement

ejabberd does not implement that.

You would need something like this, but sadly it isn't updated to work with recent ejabberd versions: https://www.ejabberd.im/mod_filter

Syndicate content