How to play multiplayer on minecraft pe?

I know you have to be on the same Wi-Fi but does anyone know how i can play my friends game or he plays mine if we're not on the same Wi-Fi, so like i'm at home on my Wi-Fi and he is at his house on his Wi-Fi is there anyway to connect to each others worlds

You can learn anything you want.

You need to CREATE a multiplayer world and list it with a server list. I know that LogMeInHamachi works for this, but you don't ever have to be on the same Wi-Fi. You just need a server name and code and voila! It works.

You can learn anything you want.

It won't work.