I am using the following code https://gist.github.com/2031681 for a simple chat app.
I run node chat-server.js and get
Tue Jan 08 2013 15:45:52 GMT+0200 (IST) Server is listening on port 1337
I try to access it through http://localhost:1337/chat.html and get the following
No data received
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
I am new to node.js and I have no idea where this problem might be coming from
I have also tried this tutorial and faced the same problem. But i have found issues and fixed it.
You have to run chat.html as a file by simply double clicking the file you dont need to access it via localhost. Also change
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
to
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
it will work. If you want it to be accessible on other computers on your network put it in wamp/www folder or htdocs folder in xampp and change the following line in frontend.js file:
var connection = new WebSocket('ws://127.0.0.1:1337');
into
var connection = new WebSocket('ws://your_pc_ip:1337');
Having search for hours from where a very similar issue can come from, when suddenly we discover that the server with our API and web service was down. The app was running at localhost, but API calls to the server don't return nothing ha-ha :(