Giter VIP home page Giter VIP logo

Comments (4)

or-else avatar or-else commented on May 20, 2024

Hi Riandy,

I think the comment in the code is incorrect but the code itself is correct. The code you pointed out collects device IDs which later are excluded. Take a look here https://github.com/tinode/chat/blob/devel/push_fcm/push_fcm.go#L73-L80
It skips the device IDs which were online and received the message. It sends to devices which were NOT online: https://github.com/tinode/chat/blob/master/push_fcm/push_fcm.go#L91

from chat.

riandyrn avatar riandyrn commented on May 20, 2024

The code you pointed out collects device IDs which later are excluded.

Yes, I’m aware of that. Hehe…

If we take a look at this block, we will see that the topic only exclude device ids which session is attached to that topic.

So for example, if user A is online by subscribing to “me” topic but he doesn’t subscribe to “topic_A”, then when there is new message in “topic_A”, user A will still receive push notification.

So in the end, user A would receive both {pres} & push notification.

This is the problem which I’m trying to address.

from chat.

or-else avatar or-else commented on May 20, 2024

So for example, if user A is online by subscribing to “me” topic but he doesn’t subscribe to “topic_A”, then when there is new message in “topic_A”, user A will still receive push notification.

Correct, the user will receive both {pres} and push. But I think that's the desired behavior. Is it not? I just checked Telegram and WhatsApp and both of them behaved in this exact way. It seems logical. What am I missing?

from chat.

riandyrn avatar riandyrn commented on May 20, 2024

Lol..🤣

Yeah, you’re right, Gene. I just checked it too. Whatsapp also have the same behavior.

I was under impression that push message should only be used when socket connection is not established between client & server. So I thought when user online, the server should not send push message towards the client.

But after observing Whatsapp, it is much better with this behavior. Because user become more aware that there is new message incoming 👍 .

Thanks a lot, Gene. Sorry to bother you. Lol.

from chat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.