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

How to use middleware in socket.io-client #1244

Closed
JaLe29 opened this issue Oct 26, 2018 · 3 comments
Closed

How to use middleware in socket.io-client #1244

JaLe29 opened this issue Oct 26, 2018 · 3 comments
Milestone

Comments

@JaLe29
Copy link

JaLe29 commented Oct 26, 2018

How can I print every payload in outgoing/ingoing requests through socket.io-client?

I don't want to use any third party library, it is possible? And how?

I didn't find any examples of this.

I am using socket.io-client

import io from 'socket.io-client'
const socket = io('http://localhost:4200')
@JaLe29 JaLe29 changed the title How to use middleware in socket.io-client How to use middleware in socket.io-client Oct 26, 2018
@darrachequesne
Copy link
Member

For future readers, catch-all listeners were added in Socket.IO v3:

socket.onAny((eventName, ...args) => {
  // ...
});

Documentation: https://socket.io/docs/v3/listening-to-events/#Catch-all-listeners

@RixInGithub
Copy link

RixInGithub commented Jul 22, 2024

For future readers, catch-all listeners were added in Socket.IO v3:

socket.onAny((eventName, ...args) => {
  // ...
});

Documentation: https://socket.io/docs/v3/listening-to-events/#Catch-all-listeners

What if I'm using lower versions than v3? I'm using v2 due to an outdated server Socket.IO version.

@darrachequesne
Copy link
Member

@RixInGithub unfortunately, the feature was not backported to v2, which is in maintenance mode.

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

3 participants