Real-time Chat Forum using Strapi, Socket.io, React and MongoDB

It would be great of this article could be updated to work with v4… I tried the following code in src/index.js:

module.exports = {

  register(/*{ strapi }*/) {},

  bootstrap({ strapi }) {
    const io = require('socket.io')(strapi.server, {
      cors: {
        origin: 'http://localhost:3000',
        methods: ['GET', 'POST'],
        allowedHeaders: ['my-custom-header'],
        credentials: true
      }
    })
  },
};

And my app crashed with this error: TypeError: server.listeners is not a function I tried to do it with setTimeout, with process.nextTick() - always the same result, same error.