I have an html page that needs to connect to a node.js server via socket.
The code works when in an html page that's hosted on my EC2 however, it's not working when I have it on an HTML page on my machine. Here's my code:
<script type="text/javascript src="http://54.213.92.113:8080/socket.io/socket.io.js"></script>
<script type="text/javascript src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
var socket = io.connect('http://54.213.92.113:8080');
$(document).ready(function(){
socket.on('jqplot', function(sentdata){
alert(sentdata);
});
});
</script>
I have no idea why this isn't working...I feel like i've don't everything correctly!
The javascript works when I comment out the line var socket = io.connect('http://54.213.92.113:8080');
Is 54.213.92.113 external EC2 address?
Is 8080 port of instance(security group) opened?