Search code examples
javascriptnode.jsnwjs

How can someone else connect to my Websocket server?


Using this module i'm making a websocket server on my pc.

Problem is: How do I let people connect into it? I know how to connect it from LAN(which is using ws:LANip:Port, for example:192.168.0.7:8000) but what if someone not connected in the same router, from another country(for example) wants to connect?

EDIT: And I tried using MyIP:Port but it doesn't seem to work.


Solution

  • Try ngrok or localtunnel. Both of them are free.

    https://github.com/bubenshchykov/ngrok

    https://github.com/localtunnel/localtunnel

    To expose your local port 8000 for instance:

    npm install ngrok -g
    ngrok http 8000