I am working on an android app that connects with esp-32 to share real-time data. I am currently using Thread to open sockets and maintain connections. Here is the code.