Event Listeners

Event Listeners are used to handle events received from the ChatCamp server.

Event listeners enable you to receive events from ChatCamp backend in real time. You may use an event listener to execute a specific workflow for any server side event. Each event listener contains various callback methods. You may override these callback methods to react to a particular chat event.

Channel Listeners

Channel listeners are designed to handle events of a channel, group or open both.

ChatCamp.addChannelListener(CHANNEL_LISTENER_ID, new ChatCamp.ChannelListener() {
	
  @Override
  public void onOpenChannelMessageReceived(OpenChannel openChannel, Message message){
  }

  @Override      
  public void onGroupChannelMessageReceived(GroupChannel groupChannel, Message message){
  }
  
  @Override
  public void onGroupChannelUpdated(GroupChannel groupChannel){
  }
  
  @Override
  public void onGroupChannelTypingStatusChanged(GroupChannel groupChannel){
  }
  
  @Override
  public void onGroupChannelReadStatusUpdated(GroupChannel groupChannel){
  }

  @Override
  public void onTotalGroupChannelCount(int count, TotalCountFilterParams totalCountFilterParams){
  }
  
  @Override
  public void onGroupChannelParticipantJoined(GroupChannel groupChannel, Participant participant){
  }
  
  @Override
  public void onGroupChannelParticipantLeft(GroupChannel groupChannel, Participant participant){
  }
  
  @Override
  public void onGroupChannelMessageUpdated(GroupChannel groupChannel, Message message) {
  }
  
  @Override
  public void onOpenChannelMessageUpdated(OpenChannel groupChannel, Message message) {
  }
  
  
});

CHANNEL_LISTENER_ID is a unique channel listener id and it is a string.

You may remove a channel listener by using its id as shown below.

ChatCamp.removeChannelListener(CHANNEL_LISTENER_ID);