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

Can we listen to io events from the client side? #539

Open
PushyPants opened this issue Sep 28, 2021 · 1 comment
Open

Can we listen to io events from the client side? #539

PushyPants opened this issue Sep 28, 2021 · 1 comment

Comments

@PushyPants
Copy link

PushyPants commented Sep 28, 2021

first off, thank you so much for creating and maintaining this package! You've saved me so much time and energy!

I'm trying to listen to reconnect events and the current syntax listens to the socket instance only (as far as I know).

sockets: {
    listener(data) {
    // do something with data
    }
}

but as noted below as of 3+ the socket instance no longer listens to reconnect events
image

is there a way for us to listen to IO events? or is there a reserved reconnect method provided by the package that we can listen to?

I've tried:

sockets: {
    reconnect(data) {
    }
}

and:

mounted() {
	this.$socket.client.io.on('reconnect', () => {
		//do stuff
	})
}

in either instance I'm not able to listen to reconnect events.

@misterdudu
Copy link

What's the socket.io-client and socket.io server version you are using?

I'm using both on 4.x and this works fine:

this.$socket.client.on('reconnect', attempts => console.log(attempts))

would be nice to integrate this to

sockets: {
    reconnect(data) {
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants