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

var io = require('socket.io')(strapi.server.httpServer, {
  cors: {
    origin: "http://localhost:3000",
    methods: ["GET", "POST"],
    transports: ['websocket', 'polling'],
    allowedHeaders: ["my-custom-header"],
    credentials: true
  },
  allowEIO3: true
});

This worked for me.