Socket.io-client-java: How do I stop listening for an event

Created on 21 Jun 2016  路  2Comments  路  Source: socketio/socket.io-client-java

Hi,

The README.md file says that

This library supports all of the features the JS client does, including events, options and upgrading transport. Android is fully supported.

But I wasn't able to find the removeListener() method from the socket object. How can I remove a listener ?

Most helpful comment

@Mouradif You have the off method.

socket.on("YOUR_EVENT", new Emitter.Listener() {

  @Override
  public void call(Object... args) { ... }

}).off("YOUR_EVENT");

All 2 comments

@Mouradif You have the off method.

socket.on("YOUR_EVENT", new Emitter.Listener() {

  @Override
  public void call(Object... args) { ... }

}).off("YOUR_EVENT");

Yep, thanks @wedneyyuri !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrgame64 picture mrgame64  路  10Comments

abhilash29 picture abhilash29  路  6Comments

emanuelet picture emanuelet  路  7Comments

anooj1483 picture anooj1483  路  9Comments

jingfreeks picture jingfreeks  路  3Comments