Tinode is not broadcasting {data} to topic subscriber

26 views
Skip to first unread message

Rifki Adrian

unread,
Jun 5, 2024, 11:56:19 PMJun 5
to Tinode General
Hi, I have been trying to integrate with Tinode for messaging, but its not fully working yet. So theres a group topic with 2 subscribers, 1 chatbot(my backend), 1 client(through mobile app), when i first create the topic and everyone subscribe, its working as expected, but then later my chatbot stops receiving {data} message and only got this {pres}.

Screenshot 2024-06-06 at 10.53.45.png

Does anyone know whats my problem is and how to fix it?

thanks in advance :)

Gene

unread,
Jun 6, 2024, 10:38:07 AMJun 6
to Tinode General
I suggest you start with reading the API documentation: https://github.com/tinode/chat/blob/master/docs/API.md

In particular, this line maybe of interest to you: 
Once the session has joined the topic, the user may start generating content by sending {pub} packets. The content is delivered to other attached sessions as {data} packets.

Also, keep in mind that the source code of the entire project is available to you. If you are serious about what you do you may wish to look at the code to learn how things work.

Rifki Adrian

unread,
Jun 6, 2024, 11:17:53 AMJun 6
to Tinode General
Hi, thanks for the answer. 

Regarding the docs, of course I have read them multiple times to understand Tinode better. I might not have explain it properly, but my condition is that, the owner of the topic(access 'O') used to receive {data} message whenever the other subscribers publish something, and at some point it stops receiving.

Anyways, i kind of have found the root cause and fixed the issue, so this problem happened whenever i re-call a function that do the handshake, login,  and sub to topic "me".  My assumption is that, this has something to do with a new session being created. And to fix it, i re-subscribe the bot to the group topic.

I still dont know why it happened and why re-sub ing fixed the issue tho. 

It would be great if you can help me understand what i do wrong in this situation.

Thank you Gene

Gene

unread,
Jun 6, 2024, 11:27:04 AMJun 6
to Tinode General
On Thursday, June 6, 2024 at 8:17:53 AM UTC-7 Rifki Adrian wrote:
Hi, thanks for the answer. 

Regarding the docs, of course I have read them multiple times to understand Tinode better. I might not have explain it properly, but my condition is that, the owner of the topic(access 'O') used to receive {data} message whenever the other subscribers publish something, and at some point it stops receiving.

You see this, right: The content is delivered to other attached sessions as {data} packets ?

To *attached* sessions. So, you need to *attach* your session to the topic. If you go to https://github.com/tinode/chat/blob/master/docs/API.md and search for the word "attach" you will find the following:

Session joins a topic by sending a {sub} packet. Packet {sub} serves three functions: creating a new topic, subscribing user to a topic, and attaching session to a topic. See {sub} section below for details.

Rifki Adrian

unread,
Jun 6, 2024, 11:32:59 PMJun 6
to Tinode General
Oh, i guess i didnt know that sessions need to be attached, i thought subscribing to the topic is enough.

Thanks for the explaination.

Reply all
Reply to author
Forward
0 new messages