I know that there are a lot of articles about controlling Raspberry Pi outputs via web interfaces, but there is nothing about doing the opposite. I would like to control web interfaces that runs on Raspberry Pi with GPIO inputs. For example, if I press the button connected to the Pi then the button in the web interface would be pressed too. I just want to understand tha concept that should be used to get a bi-direcrectional communication. Thanks!
What you would need to do is utilise a socket. A socket allows a server and client to communicate directly with an ongoing connection.
The advantage of this is fairly high. Let's say you want a user interface on the Raspberry Pi, you'll find most interfaces are fairly lacking. Except on of course: HTML. This pretty much sounds like what you want. You have a server which presents a UI, as well as a socket that can communicate directly with the pages. Then you can even allow the pages to give feedback to the server, or simply allow the server to react to physical elements like a button push and then inform the sockets of a state change.