I trying to make a small chat website using node.js and socket.io. To include the socket.io.js on my client-sided files:
<script src="192.168.0.108:1337/socket.io/socket.io.js"></script>
But is it normal that it returns an empty file? http://screencast.com/t/HPAjAqV13q8q
I would also like to add that if on my server-sided file, I do res.write('Hello World'), the 'Hello World' Will appear on the web-page AND in the socket.io.js file
You can try this:
<script src='/socket.io/socket.io.js'></script>
And you should created a client io.connect
var socket = io.connect('http://localhost:5000');
You can also use socket.io's auto-discovery feature and don't specify the server
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect();
</script>
What solved it was opening the port on which socket.io was listening, in my case it was 8080... Now my socket.io.js has javascript code inside of it.
Now I am getting a 404 error on a xhr.send(null) in that socket.io.js file, but that is another story...