Open mcorning opened 3 years ago
3.x seems to be working fine for my use case
Excellent. Thanks for the reply.
Sent from Samsung tablet Get Outlook for Androidhttps://aka.ms/ghei36
From: Dillon Bussert notifications@github.com Sent: Saturday, November 14, 2020 2:46:16 PM To: MetinSeylan/Vue-Socket.io Vue-Socket.io@noreply.github.com Cc: Michael Corning mcorning@outlook.com; Author author@noreply.github.com Subject: Re: [MetinSeylan/Vue-Socket.io] socket.io V3 (#292)
3.x seems to be working fine for my use case
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MetinSeylan/Vue-Socket.io/issues/292#issuecomment-727276007, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABYY7LQ2BHUV5BE3PHHXX53SP4CDRANCNFSM4TT3A5VQ.
3.x seems to be working fine for my use case
@dbussert Could you please share what is required for migration? I tried migrating but the client refuses to connect to the server
I have a working system with the latest of all libraries. This is generally what you need.
client
package.json
"socket.io-client": "",
"vue-socket.io": "",
main.js
import VueSocketIO from 'vue-socket.io'
import SocketIO from "socket.io-client"
...
Vue.use(new VueSocketIO({
debug: true,
connection: SocketIO(`/`, {
path: '/socket'
})
}))
App.vue
sockets: {
async message(message) {
//handle message
}
},
server
package.json
"socket.io": "",
express web server
const io = require('socket.io')(http, { path: '/socket' })
...
io.emit('message', json)
nginx
location /socket/ {
proxy_pass http://your-express-server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
Actually it doesn't work perfectly, look at all the warnings you get in the compilations and during the execution in the console.
It doesn't work for me out of the box. this library is using socket-io v2
socket-io v3+ servers probably need to set backward compatibility, otherwise it doesn't work https://socket.io/blog/socket-io-3-1-0/
It doesn't work for me out of the box. this library is using socket-io v2
socket-io v3+ servers probably need to set backward compatibility, otherwise it doesn't work https://socket.io/blog/socket-io-3-1-0/
Like @leonardlin said, compatibility mode (allowEIO3: true
) is available between a Socket.IO v2 client and a Socket.IO v3 or v4 server.
On the server side:
const io = require("socket.io")({ allowEIO3: true });
Has anyone gotten this to work with the Vue 3 composition API?
Will vue-socket work with socket.io V3?