vue-socket.io-extended
vue-socket.io-extended copied to clipboard
Exporting sockets object into a class/plugin
Rather having everything sit in main.ts, is there a way to export sockets into a class of it's own?
Having something like this can get rather cumbersome..
new Vue({
sockets: {
connect() {
this.$socket.client.emit("connected", {
title: "cod"
});
this.$socket.client.on("connected", (data: string) =>
console.log(data)
);
}
},
However when I try to use this.$socket in src/plugins/index.ts I get Property '$socket' does not exist on type 'NextClietPlugin'
Can you recommend anything @probil ?
Hey @rostgoat
Could please provide me the class you've tried in src/plugins/index.ts? Without seeing usage it's hard to figure out the problem and why it didn't work