I am trying to follow along with a simple example of Socket.IO located at http://socket.io/get-started/chat/. So far I have the following code in my index.js file:
// INDEX.JS File var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); app.get('/', function (req, res) { res.sendfile('index.html'); }); io.on('connection', function (socket) { socket.on('chat message', function (msg) { console.log('message: ' + msg); }); }); http.listen(3000, function () { console.log('listening on *:3000'); });
The error I am getting is:
The connection to ws://localhost:3000/socket.io/?EIO=2&transport=websocket&sid=i0SyiRvHJC1GUiafAAAC was interrupted while the page was loading.
I'm using FireFox
to browse the page. It also doesn't work in Chrome
.