SolvedVue Socket.io Latest version breaks library

Describe the bug
When using the latest version I get the following error:
TypeError: o.sockets.subscribe is not a function

This is caused when I try to run this.sockets.subscribe('name', ...)

Expected behavior
The app is supposed to access the sockets via this.sockets. as it did in previous version

Desktop (please complete the following information):

  • OS: Linux
  • Browser Chrome, Firefox

Additional context
Reverting to previous version 3.0.7 solved the issue.

I could not pinpoint the issue in source code due to ... minimization?

16 Answers

✔️Accepted Answer

Until the bug is fixed, everyone who has a similar problem and don't wants to change own code - can install the version 3.0.5.

npm i vue-socket.io@3.0.5 - in dependencies

And lock version in packege.json: "vue-socket.io": "3.0.5"

I have the same problem but this version is not broken yet.
And I don’t understand why to make such changes in the patch version.
It's breaking changes. They should be at least in a minor, and preferably a major version with explanations.

Problem started from this changes.

Other Answers:

Since last version component methods in sockets: don't get triggered anymore. I don't get any error, but sample methods (connect, customEmit) from example below never get triggered:

    sockets: {
        connect: function () {
            console.log('socket connected')
        },
        customEmit: function (data) {
            console.log('this method was fired by the socket server. eg: io.emit("customEmit", data)')
        }
    },

I think it is related to original issue reported ... ?
When I downgraded to 3.0.7 is started working again.

Version 3.0.9 is still broken for me, needed to revert to 3.0.7 to get it working again.

@goliafrs is correct in the location, it originates from commit 8988085 "Handle more than one namespace". The changes to the mixin file do not properly add the event listeners for all configurations of the plugin, as well as it contains a number of inconsistencies with its documentation.

I had submitted a PR, #242, in March, both adding namespacing for Vuex modules as well as reverting this specific commit. For any still facing issues, I echo the suggestion to revert to v3.0.7 until the issue is addressed.

More Issues: