Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
How can I put the server IP address when I connect to the server in the frontend?
var socket = io.connect('http://localhost:3000/panel');
So instead localhost put the correspondent server IP address for the production environment.
Thanks.
http://www.google.com
Since this Javascript is executing in the client, you can just do the following:
document.location.hostname contains the hostname, and document.location.port the port. It's as easy as that.
document.location.hostname
document.location.port
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
http://www.google.comthough you would of course use your own registered DNS name.