hynek-urban / rocketchat-async

asyncio-based Python wrapper for the Rocket.Chat Realtime API.
MIT License
13 stars 9 forks source link

Duplicating messages in subscribe_to_channel_messages #3

Closed seregagl closed 8 months ago

seregagl commented 1 year ago

I authorize in RocketChat server and subscribe on the one channel to get channel messages. After that, i send a message in this channel and get message in my code twice. One message has property "unread" and the messages have different timestamps. In other properties, the messages are the same. I turned on verbose mode and saw, that rocket chat server really sent me two notifications via opened web socket.

I think, that the first message is the real notification about new message in the channel, and another - notification about the user have read the message (blue check mark on the message).

The main problem, that inside my client code i can't get property "unread", because in my callback function i don't have all event data, sent by server.

hynek-urban commented 8 months ago

@seregagl Sorry I haven't replied earlier.

I tried enabling message receipts and then I was able to reproduce your issue. I've changed the signature of the callback inside subscribe_to_channel_messages to accept an additional parameter unread as that's the simplest solution for now.

(Probably not useful for you any more but perhaps it will be for someone else.)