personally, i recommend using discord (or similar). no home rolled thing or phpBB extension will ever be as featureful, and by using an external service, you won't have to maintain or support it yourself.
here's a post showing you how to integrate it into phpBB nav menu:
my example only exposes the chat dropdown to logged in phpBB users (and not bot users).
it shows who's online on discord and will pass the phpBB username so it autopopulates when the user joins the chat. also, your users don't need to create discord accounts, so there's no friction. you click a couple things and just start chatting.