Is there some way to check if user has unread messages?

79 views
Skip to first unread message

Soy yo

unread,
Oct 28, 2020, 1:22:56 PM10/28/20
to Tinode General
Some time ago I read a discussion on github on number of new messages and I know that it is not possible to determine the exact number. My question is - is it at all possible to determine whether an user has unread messages.

I need to show this information on my website outside of Tinode's apps. Users may browsing the website and if there is no messages indicator they will not open the chat.

Currently I am using nodejs/socket.io/mysql chat and users table contains "new_messages" column where the number increases or resets when user access the chat.
Even if user is not browsing the website but it's open, background script checks the new messages number every 5 minutes and updates the new messages indicator.

What are the chances of finding out if there are unread messages in Tinode?


Gene

unread,
Oct 28, 2020, 4:55:33 PM10/28/20
to Tinode General
On Wednesday, October 28, 2020 at 10:22:56 AM UTC-7 Soy yo wrote:
Some time ago I read a discussion on github on number of new messages and I know that it is not possible to determine the exact number.

Technically it's possible with some code changes. The push for iOS sends the total number of unread messages in every push. It should be possible to create a custom push handler which would receive the same info.
 
My question is - is it at all possible to determine whether an user has unread messages.

Subscribe to 'me', get all user's subscriptions. They will contain the number of unread messages in every topic.

I need to show this information on my website outside of Tinode's apps. Users may browsing the website and if there is no messages indicator they will not open the chat. 

Currently I am using nodejs/socket.io/mysql chat and users table contains "new_messages" column where the number increases or resets when user access the chat.

You can pull the info from the Tinode DB too:

Do a join of topics & subscriptions, then SUM(subscriptions.readseqid - topics.seqid). It won't be precise if some topics are muted or archived, but it will give you an idea. 
Reply all
Reply to author
Forward
0 new messages