Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting sockets object into a class/plugin #440

Open
rostgoat opened this issue Feb 25, 2020 · 1 comment
Open

Exporting sockets object into a class/plugin #440

rostgoat opened this issue Feb 25, 2020 · 1 comment
Labels
question 🤔 Further information is requested

Comments

@rostgoat
Copy link

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 ?

@probil
Copy link
Owner

probil commented Apr 8, 2020

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

@probil probil added the question 🤔 Further information is requested label Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question 🤔 Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants