The idea is to use the ESP instead of the Arduino. The ESP can control the relay by itself. If you want to connect ESP and Arduino you can do it by wires, using SoftwareSerial.
If the devices are separated and you need network - there are several examples how to connect two devices, like in this https://www.b4x.com/android/forum/threads/esp8266-wifi-remote-configuration.68596/