What you need is a socket server on the python end and a client/request server on the javascript end. For the python server side, refer to SocketServer , (example taken from there as well), one thing you have to make sure is to have the socket go past NAT (possibly port forwarding).