I am attempting to connect to a node.js server via a web socket. The difficulty I am having is that my node server does not serve my web pages. From looking at it I think socket.io assumes that the server will be serving the pages so I can't use 90% of the examples out there (or at least I haven't figured out how to). I am trying to get this simple demo page to connect but am always getting connection refused.
<html>
<head>
<title>Title</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
var ws = new WebSocket("ws://my-devbox.local");
</script>
</head>
<body>
<button id="myButton">Click Me Mo Fool!!!</button>
</body>
In my app.js I have the following (with extraneous information omitted)
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
io.sockets.on('connection', function (socket) {
console.log('A new user connected!');
//socket.emit('info', { msg: 'Hello World' });
});
Thanks