tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

message delay #3062

Closed gplgpl775 closed 1 week ago

gplgpl775 commented 1 month ago

Now I have a problem, I am creating a client using 'client = tdl.createClient(publicValue)' by 'var allmessage = await client. invoke( { : 'getChatHistory', chat_id: itemQun.chat_id, from_message_id: itemQun.from_message_id, offset: -99, limit: 99 limit: 99 } )' to get telegram messages (my program must use getChatHistory to get messages, because I am using vpn to access the extranet, and I want to realize that when the VPN is interrupted, and it returns to normal, I can continue to get the data according to the previous ids), in the initial stage of login, there is no delay in getting the messages, but when the After 3-4 days of running the program, some of the groups started to have delayed messages, so I decided to restart the project using node, and for about 1-2 two days these same groups had the same delay, so I deleted the login information and re-logged in, and persisted for 3-4 days, and then started to have the delayed messages again (it's always been a fixed number of groups). So what is the cause of this please? It is important to note that there are many groups under the current account and the volume of group messages is also high. Techniques: node; prebuilt-tdlib:“^0.1008034.0”; tdl:“^8.0.1” Looking forward to your reply, thanks!

levlam commented 1 month ago

getChatHistory is not supposed to be used to fetch new messages.

Also, messages in supergroups and channels aren't supposed to be received immediately. They can be received by different users with different delay.

gplgpl775 commented 1 month ago

I understand what you mean, but I have to use "getChatHistory", so now I have a question, when I start a program, there is no delay at first, but after 3-4 days, the delay of some specific groups can reach 1 hour or even longer. When I pause the program and restart it, the delay disappears, but after a few days, the delay will appear again. What is the reason for this? @levlam

levlam commented 1 month ago

It can be anything and it is most likely to be intended. New messages are supposed to be received only through updateNewMessage and getChatHistory can't affect receiving of new messages.

gplgpl775 commented 1 month ago

OK, I understand, thanks

它可以是任何东西,而且很可能是有意为之。新消息只能通过它接收updateNewMessagegetChatHistory不能影响新消息的接收。