MetinSeylan / Vue-Socket.io

😻 Socket.io implementation for Vuejs and Vuex
https://metin.sh
MIT License
3.95k stars 496 forks source link

Adds basic Vue 3 compatibility #289

Closed veryeasily closed 3 years ago

veryeasily commented 3 years ago

This pull request adds Vue 3 compatibility which should fix #284.

Previously this fix was open as #287 but seems like it was maybe prematurely closed. I tested my changes out and they appear to work on both Vue 3 and Vue 2.

As a warning though, my vue 3 tests have not been super thorough because my application is having vue 3 problems with unrelated dependencies. This PR gets past the initial issue, but there may still be deeper problems to debug.

hajoch commented 3 years ago

Any updates?

chuckntaylor commented 3 years ago

Is this fix confirmed to be working?

stefa168 commented 3 years ago

Is this fix confirmed to be working?

Yes, it does fix the error reported in #284. While waiting for the pull request to be accepted I forked the repo and pushed a custom build of the plugin, because I needed it asap.

chuckntaylor commented 3 years ago

Thanks! I think I find myself in the same boat.

stefa168 commented 3 years ago

Thanks! I think I find myself in the same boat.

Actually, I forgot to add that the typings are also broken, if you're using Typescript.

The absolute minimum required to get everything to work is a definition of the custom properties:

declare module '@vue/runtime-core' {
    interface ComponentCustomProperties {
        $socket: SocketIO.Socket,
    }
}

I placed this declaration in my app entrypoint. I found this solution on stackoverflow.

bayernjava commented 3 years ago

Any updates?

Richard1984 commented 3 years ago

@MetinSeylan could you merge it please?

wkuinkc commented 3 years ago

Happy to see this merged too.

wkuinkc commented 3 years ago

thanks for merging! I tried running npm update vue-socket.io and it still doesn't seem to be working

stefa168 commented 3 years ago

@wkuinkc try changing your dependency to point to this repo instead of the npm package; the latest release goes back to August of last year

thibqn commented 1 year ago

@MetinSeylan, the NPM version doesn't seem up to date. Is there an upcoming update ? It would be greatly appreciated !