ws://127.0.0.1 only local

0 favourites
  • 5 posts
From the Asset Store
"Easy Local Notifications" enhances games with customizable local notifications.
  • i can't connect externally to ws // 127.0.0.1 on my pc it works but not on other external pc

  • 127.0.0.1 is an IP Address that computers interpret as "this is me".

    Lets say you have 2 computers: computer A, and computer B.

    Computer A has your websocket server installed.

    If computer A connects to 127.0.0.1, then it will work.

    If computer B connects to 127.0.0.1, then this will fail as computer B tries connecting to itself and cannot find the websocket server.

    You need either the external IP address, or a local IP address, of your websocket computer, in order to get other computers to connect to it successfully.

  • yes the problem is B) but as public external ip check ,, on node.js I can start server by configuring only local host or 127.0.01, otherwise it will not start

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • How much networking knowledge do you have? Would you say you're a beginner, advanced, or an expert in networking? I will assume beginner, but my apologies if I am wrong!

    I don't know a lot about node.js, but if I was in your position, I would try to configure node.js to use my local IP (usually looks like 192.168.1.x) and try to prove that I could get a 2nd computer in my home, or my mobile phone on my WiFi, to connect to the websocket server.

    The above is safe to try, but the below stuff can sometimes be dangerous if you do the wrong thing, so please be careful - I'm only writing this for educational reasons!

    Once you have succeeded with the above, then you have the world of port forwarding and external IP addresses to deal with.

    If you find out the ports required for node.js, and find out your local IP address on your websocket server, then you could login to your router, find a section called "port forwarding", and then you can add these ports along with your local IP address of your websocket computer.

    You can then go onto Google, and type "whats my IP" to find out your external IP address. You can then configure node.js to use this IP, and in Construct 3, use this IP in your ws:// event to connect to.

    NOTE: your external IP address will change periodically, so this might not work after a day passes - you need to register to get a static IP address if you want to keep the same external IP address.

    Now at this point, you can test this! Lets say you have a mobile phone with 4G to test this. You could use preview over WiFi onto your phone, then turn off your WiFi on your phone so that you are on 4g, and try connecting to your websocket server. Hopefully it will be a success!

    Hope this helps, please be careful and take it slowly - Google the words you don't know and try to learn everything thoroughly. Assuming you are doing this at your home, you don't want to mess up your router settings and break your Internet connection or anything! But sometimes the only way to learn, is to try, if you're happy to take the risk.

  • you do not have to excuse yourself in what you guessed, thanks in advance for everything, I did as you recommended and everything comes back and works, only in the first part, the external computers see, only that as soon as I put my external ip on construct ws \\ my-external-ip I get this error:

    "signaling error: Failed to construct" wensocket "an insecure websocket connection may not be initiaded from a page loaded over HTTPS" if I try to put it with wss \\ my-external-ip I don't get happened connection"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)