HTML page not connecting to AWS server

Dennis Dixon asked:

I am trying to connect an html page hosted with my ISP provider with an Amazon Web Services micro-instance server using socket.io.

I am trying to use the most basic example possible that is provided by the socket.io web page:

http://socket.io/

Here is the client code posted in index.html:

<html>
    <head>
        <title>Webrtc.js Demo</title>
    </head>
    <body>
<script src="http://ec2-54-244-211-64.us-west-2.compute.amazonaws.com:8080/socket.io   /socket.io.js"></script>
<script>
  var socket = io.connect('http://ec2-54-244-211-64.us-west-2.compute.amazonaws.com /server.js:8080');
  socket.on('news', function (data) {
    console.log(data);
    socket.emit('my other event', { my: 'data' });
  });
</script>
    </body>
</html>

Here is the server code posted in my ec2-user directory as server.js:

/*global console*/
var io = require('socket.io').listen(8080);
io.sockets.on('connection', function (socket) {
  socket.emit('news', { hello: 'world' });
  socket.on('my other event', function (data) {
    console.log(data);
  });
});

When I go to index.html at the bottom of the browser it says it’s trying to connect but I never get a “hello world” in the browser.

Possibly there are certain debugging commands I can use to track down the problem.

Any help would be appreciated.

My answer:


Open port 8080 in your AWS security group.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.