Question from the Node.js test

How to use socket.io with an Express server

Hard

If I define myExpress server like this:

const app    = require('express')();
const server = app.listen(3000);
const io     = require('socket.io');
const http   = require('http');

How can I usesocket.io so that I can doio.on('connection', …)?

Author: Jean-marie CléryStatus: PublishedQuestion passed 886 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!