All websockets begin as normal HTTP servers. On the upgrade event, the server can upgrade to a websocket, allowing bidirectional communication. This video gives a pretty good overview of the process.