What does require('socket.io')(http) mean in node js

It has two parts, requiring a module with CommonJS

require('socket.io')

And calling the function it returns, passing in an http variable.

(http)

Can be rewritten as

var socketio = require('socket.io');
socketio(http);
1 Like