probil / vue-socket.io-extended

:v::zap: Socket.io bindings for Vue.js and Vuex (inspired by Vue-Socket.io)
MIT License
628 stars 38 forks source link

connected/disconnected loop #514

Closed sb2050 closed 3 years ago

sb2050 commented 3 years ago

After changing the socket.io server version to 2.4.1 the connection works now. But now I get a loop where the socket connects all the way to the server and then closes again.

Firefox: https://imgur.com/bYxjgLt https://imgur.com/iJpTIMm

I have included the extension as follows: VueApp: mainjs:

import VueSocketIOExt from 'vue-socket.io-extended';
import { io } from 'socket.io-client';

const socket = io(store.getters.env.api.url);

Vue.use(VueSocketIOExt, socket, { store });

App.vue:

export default {
  sockets: {
    connect() {
      console.log('socket connected');
    },
    customEmit(val) {
      console.log('this method was fired by the socket server. eg: io.emit("customEmit", data)');
    },
  },
}
probil commented 3 years ago

@sb2050 Could you show me your BE code?

alza54 commented 3 years ago

@sb2050 You probably need to downgrade socket.io-client version to 2.4.0.

probil commented 3 years ago

Seems like v2.4.1 has been discounted and no more available on npm. Check Versions tab here: https://www.npmjs.com/package/socket.io-client

I tested the library with v2.4.0, v3 and v4 yesterday. All versions work fine. Please comment here or create a new issue he if you still experience the problem