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

Need to be able to listen to all "other" events #243

Closed
chenjianjx opened this issue Nov 5, 2015 · 12 comments
Closed

Need to be able to listen to all "other" events #243

chenjianjx opened this issue Nov 5, 2015 · 12 comments
Milestone

Comments

@chenjianjx
Copy link

After a series of "on event_a", "on event_b", I need to listen to other events that have not been defined by my code.

This is very important for troubleshooting. Sometimes I expect the server side to send me an event but it sends me another event which I haven't listened to. I don't know what this event is because I can't listened to unexpected "other" events.

@nkzawa
Copy link
Contributor

nkzawa commented Nov 9, 2015

Unfortunately, there is no way to do that for now. Basically, you need to know what kind of events server sends.

@chenjianjx
Copy link
Author

Yes, there is. Other socket.io java clients can do that. Can you seriously try it?

@nkzawa
Copy link
Contributor

nkzawa commented Nov 11, 2015

What I meant is this library doesn't support "oher" events. And I have no though to do so for now since JS client also doesn't.
Can you propose this as an issue of socketio/socket.io-client if you really think we should have the feature?

@Aksi0m
Copy link

Aksi0m commented May 24, 2016

I am also in need for a feature like that!

@Raduzz
Copy link

Raduzz commented Dec 26, 2017

Yes. I need to listen all events as well.
There is a working solution for JavaScript socket-io-client-respond-to-all-events-with-one-handler (second answer).
I see there is a custom decoder in socket.io-client-java from version 1.0.0. Is this a way? There is included test in repository but I can not figure out how to use it.

@pauljackals
Copy link

Hi, JS client has .onAny() now, maybe you'll reconsider adding something like that? 🙂

@rezafaraji93
Copy link

I really this onAny too!

darrachequesne added a commit that referenced this issue Jul 8, 2022
Syntax:

```java
socket.onAnyIncoming(new Emitter.Listener() {
    @OverRide
    public void call(Object... args) {
        // ...
    }
});

socket.onAnyOutgoing(new Emitter.Listener() {
    @OverRide
    public void call(Object... args) {
        // ...
    }
});
```

Related:

- socketio/engine.io-client-java#99
- #243
- #475
@darrachequesne
Copy link
Member

Here we go:

socket.onAnyIncoming(new Emitter.Listener() {
    @OverRide
    public void call(Object... args) {
        // ...
    }
});

Included in version 2.1.0

@darrachequesne darrachequesne added this to the 2.1.0 milestone Jul 10, 2022
@irshadir7
Copy link

is it possible to track all possible events by using 1x version? because the latest version is not able to connect to the server due to incompatibility . can i achive onAnyIncoming in version 1.0.1

@darrachequesne
Copy link
Member

@irshadir7 hi! I will backport the changes in the 1.x branch, let me check.

@irshadir7
Copy link

irshadir7 commented Dec 7, 2022 via email

@irshadir7
Copy link

irshadir7 commented Dec 8, 2022 via email

cedev935 added a commit to cedev935/socket-java that referenced this issue Sep 14, 2023
Syntax:

```java
socket.onAnyIncoming(new Emitter.Listener() {
    @OverRide
    public void call(Object... args) {
        // ...
    }
});

socket.onAnyOutgoing(new Emitter.Listener() {
    @OverRide
    public void call(Object... args) {
        // ...
    }
});
```

Related:

- socketio/engine.io-client-java#99
- socketio/socket.io-client-java#243
- socketio/socket.io-client-java#475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants