tinode / chat

Instant messaging platform. Backend in Go. Clients: Swift iOS, Java Android, JS webapp, scriptable command line; chatbots
GNU General Public License v3.0
12.06k stars 1.88k forks source link

[Ask Difference Between {del} & {leave}] #32

Closed riandyrn closed 7 years ago

riandyrn commented 7 years ago

Hello, Gene

I have question regarding {del what=topic} & {leave unsub=true}. Are these both functions basically done something equivalent?

I noticed that these both functions basically deleting user subscription. Maybe the only difference is when we use {leave} we must already subscribed to the topic while {del} is not. So is my understanding correct?

Thanks

or-else commented 7 years ago

Hi Riandy,

riandyrn commented 7 years ago

Hoo…, ok (y)

So suppose we have p2p connection between user A & user B. Suppose user A delete its subscription by either using {del what=topic} or {leave unsub=true}. What supposed to happen in case of user B sending message to user A? Does user A still supposed to receive {pres} packet from user B or not?

I found that sometimes in such case Tinode will still sent {pres} packet to user A, but sometimes it doesn’t. So I would like to confirm which behavior is true in this case.

or-else commented 7 years ago

Once the subscription is deleted, neither messages no pres should go through. I know pres sometimes goes through and it's a bug.

or-else commented 7 years ago

I fixed the p2p issue with unnecessary {pres} being sent or needed not sent : https://github.com/tinode/chat/commit/543a530740c65bb85e8a2bb60c415446a18d5783

I think there is still an issue with presence being sent or not sent in p2p topics when the P permission is changed. I think it's rare enough. I'll fix it later.

riandyrn commented 7 years ago

Ok, thanks a lot, Gene. It's clear now (y)