sorry for the silly question and im sure its a noob mistake. I am following the how to use for socket io: http://socket.io/#how-to-use and keep having an problem;
I have a node app (running version 3.0 alpha of express) and have the following:
app = express()
io = require('socket.io').listen app
I have edited the layout.jade and added:
script(src="/socket.io/socket.io.js")
I have also run npm install socket.io
and confirmed that it starts fine on the server.
If I browse to any page, console keeps showing:
GET http://localhost:3000/socket.io/socket.io.js 404 (Not Found)
Anyone else experienced this issue?
Here are step by step instructions I just tested them
express socket
cd socket
npm install
npm install socket.io
Add the following in app.js
var io = require('socket.io').listen(app);
Run
node app
In the console you should see
info - socket.io started
In the browser go to
http://localhost:3000/socket.io/socket.io.js
You should see the raw JavaScript
Edit:
I'm also having problems with 3.0alpha1. Looks like a bug. Here is an ugly work around
var fs = require('fs');
app.get('/socket.io/socket.io.js', function(req, res) {
fs.readFile('/PROJECT_HOME/node_modules/socket.io/lib/socket.io.js', function(error, content) {
if (error) {
res.writeHead(500);
res.end();
}
else {
res.writeHead(200, { 'Content-Type': 'text/javascript' });
res.end(content, 'utf-8');
}
});
});
Are you runnning layout.jade from the app.js?
app.get('/',function(req,res){
res.sendfile('index.html');
});
This needs to be included in the app.js assuming your template is in index.html file.