I just tried to use 'Socket.io' For initial setting, document says the code below
var app = require('express')(); var server = require('http').Server(app); var io = require('socket.io')(server); server.listen(80); and this is my original code.
var app = require('express')(); app.listen(80); what's the difference between two? Specifically 2 questions.
- require('http').Server(app) => Why do I need to put app as a argument of Server?
- why do i have to use server.listen() instead of app.listen() ??
I looked up the document of node.js and express.js but can't understand...
I'll be really appreciated for your full explanation...