I need to load in the npm module socket.io. I have npm install'ed it. My app uses React, and if I follow correctly, I need to load socket.io from inside a particular component. Following these docs:
… I’ve tried the following at the top of the component:
var io = require('socket.io')(http, { serveClient: false });
I’ve also tried:
var io = require('socket.io')();
io.serveClient(false);
io.attach(http);
I’m getting this console.log error:
Uncaught Error: Cannot find module 'http'
I’ve run npm install http, but I’m still getting this console error.