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

Feature Request: Cloud Message Logging #140

Open
mandrachek opened this issue Oct 14, 2019 · 3 comments
Open

Feature Request: Cloud Message Logging #140

mandrachek opened this issue Oct 14, 2019 · 3 comments
Labels
feature request Request a new feature to be developed

Comments

@mandrachek
Copy link

I currently have to log FCM messages for debug builds of my application. It would be great if I could offload this responsibility to chucker. Perhaps by supporting an additional data type that would result in a 3rd tab, "Messages" or "Data" or something along those lines, that I would then be able to call in my FcmMessageReceiver implementation's onMessageReceived handler to be able to pass the message into Chuck for logging.

I don't expect you'd want to add a dependency on the FCM libraries, but supporting most of the values in the RemoteMessage class would be great. The only one that would be mandatory would be the data (Map<String,String>), and the current timestamp.

Something like:

  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
     chuckerCollector.onMessage(remoteMessage.getData());
  }

or:

  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
     chuckerCollector.onMessage(
       remoteMessage.getData(),
       remoteMessage.getFrom(),
       remoteMessage.getTo(),
       remoteMessage.getMessageId(),
       remoteMessage.getmessageType(),
       remoteMessage.getSentTime(),
       remoteMessage.getTtl()
    );
  }

This or something like it could be useful to a lot of people, even if they're not using it for cloud messaging.

@ColtonIdle
Copy link
Sponsor

This is interesting. I really like keeping Chucker to just network traffic, but I guess one could argue that this is a form of network traffic. The same feature framework being discussed in #100 could maybe be used here as well?

@psh
Copy link
Contributor

psh commented Oct 20, 2019

Going with the open-closed principle for a moment, the core of Chucker is the ability to monitor HTTP traffic. Hopefully the core of Chucker being closed for modification but open for extension would allow for adding nuances (like graphql, websockets or FCM messages) without core classes being modified.

Square's Retrofit handles this by having external modules act as Converter Factories and Call Adapter Factories where these external modules are dependent upon Gson, Moshi, Jackson, RxJava, etc. The core of Retrofit doesn't need to be modified when the next body encoding mechanism comes along. Would a similar approach work here?

@cortinico cortinico added the feature request Request a new feature to be developed label Oct 24, 2019
@cortinico
Copy link
Member

Would a similar approach work here?

Absolutely. Ideally having ChuckerCollector and ChuckerInterceptor as extensions point could allow to extend the behavior of Chucker to support new features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request a new feature to be developed
Projects
None yet
Development

No branches or pull requests

4 participants