how to publish and subscribe the data by using esp Node MCU step by step?

any one explain about how to publish and subscribe data step by step by using node MCU.

another question that i have two esp`s ,esp A and esp B .A publish the data and B subscribe the data and send to local server by using mqtt is it work? A publish(not connected to pc its just wifi) ------>B Subscribe(connected to pc) and publish same data----->local server in pc Subscribe the data is it work.

design A publish data----->b Subscribe data and again publish data ------>local server Subscribe data by using mqtt. for better understanding. 2.if i need to publish any data, we need to convert it to char datatype?