Search code examples
python-3.xd3.jswebsockettornado

How to expose tornado websocket from local machine


I have built a d3.js dashboard that ties into a tornado websocket. Everything works perfectly locally. I now would like to have the ability to share the websocket with a few friends, nothing production. Is there a way to do this without a big deployment on Heroku or other similar service? I've googled and can't seem to find an answer. Thanks


Solution

  • Not specific to Tornado. This is more of a networking question.

    What you want to do is:

    1. Run your server on your computer.
    2. Connect to the internet.
    3. Note down your public IP address.
    4. Give your IP address to your friends.

    Certain things you need to take care of:

    1. Run your server on a higher, non-standard port (e.g. 8000 would be good) because ISPs block traffic to port 80 and other standard ports.
    2. The IP address assigned to you by your ISP will most probably be dynamic. That mean, every time you diconnect and reconnect to the internet, your IP address will change.
    3. Turn off your computer's firewall to let in the traffic at whichever port your server is running.
    4. Finally, you'll need to configure port forwarding on your router. What that means is all the incoming HTTP requests will arrive at your router at your public IP address. But your computer where you'll be running your server will have an internal IP address assigned by your router. So, you'll need to forward incoming requests to your computer's internal IP.