I am trying to create a new notifier system using nodejs, for that i am using socket.io. what is the difference between the below two codings.
Coding 1: //Created a HTTP server and Socket connection
var app = require('express').createServer()
var io = require('socket.io').listen(app);
app.listen(8080);
Coding 2: //only created Socket connection
var io = require('socket.io').listen(8080);
Please suggest?
There is no real difference. The latter is merely a shortcut for the former.
One tiny difference does exist though: The shortcut will add a default HTTP request handler (for non-websocket requests) that responds with Welcome to socket.io.
.