Connect to replit ip of my server
Hi! I'm trying to make a websocket server and I've got the server's IP.
When I connect to my server by domain i get
172.18.0.49, that is the server's IP. Now, if I want to connect by ip, I get
The site took too much time to answer (translated). Can I connect by IP?
The IP you're trying to connect to isn't the correct one. IPv4 addresses which start with
172 are private network addresses, so it won't work properly. According to whois, the actual IP is 18.104.22.168, though that points to repl.co. So as far as I know, no, you can't connect by IP. May I ask why you are trying to?
@19wintersp yeah. But what I'm trying to do is this:
I want to make a server for my application, but (dont know why) it does not connect to the application if I connect it by the project.username.repl.it. What I wanted is to open a web server on port 5000 and on the index show the current ip, so to be able to connect like ip:1234 that is the port of the websocket. (The appñication is an android application, using socketio (websockets))
@Necrodragon41 A port can only be used by one app at a time. Most WebSocket libraries allow you to attach the WebSocket server to a HTTP server to make it work correctly with both. The reason Replit knows is to do with the way the protocols work. A WebSocket request will have a special header which tells the server to use a WebSocket connection instead.