OMG, I've written WebSocket server, it was pain, pain in the ass.