I am using the example from the Socket.IO homepage (http://socket.io/). It works and everything, but there is a huge delay between the time data is sent, and when that data is received on the other end.
I am using XAMPP, I have socket.html in my dir, and navigate to it using "http://localhost/socket.html" in my browser, and I have the server listening on port 8080.
Server:
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);
});
});
HTML File:
<html>
<head>
<script src="http://localhost:8080/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8080');
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
</script>
</head>
<body>
</body>
</html>