ssr with socket io

  • Hi there! i am using SSR mode, and i was wondering how to initialize web socket server on my server. i have modified extension.js as below:

    module.exports.extendApp = function ({app, ssr}) {
        const server = http.createServer(app)
        const io = socketIO(server)
        io.on('connection', (socket) => {

    which does not work, it only works if i add this line to extension.js:


    but this is a bad idea, because anytime i made changes to this file, my dev server crashes and it is normal behaviour.

    what do you guys suggest?

Log in to reply