I'm building a chat app using socket.io: 2.0.2, nuxt: 2, vue-socket.io: 3.0.10. The app works fine locally, but socket.ui stops responding after uploading to the server. How can this problem be solved?
server:
const io = require('socket.io')(3001, {
cors: {
origin: '*'
}
})
io.on('connection', (socket) => {
...code
})
export default function (req, res, next) {
next()
}
client:
import Vue from 'vue'
import VueSocketIO from 'vue-socket.io'
export default function ({ store }) {
Vue.use(
new VueSocketIO({
debug: false,
connection: 'http://localhost:3001',
vuex: {
store,
actionPrefix: 'SOCKET_',
mutationPrefix: 'SOCKET_'
}
})
)
}
i tried to write
connection: 'http://app.com:3001'
for the client, but it didn't solve the problem