Here’s a detailed tutorial on how to make two ESP8266 talk with each other from Rui Santos:
How it works? You’re going to set one ESP as an Access Point (Server) and another ESP as a Station (Client). Then they’ll establish a wireless communication and the Client sends a message to the Server saying “Hello World!”.
Project info at Rui’s Random Nerd Tutorials site.