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

Inconsistent results as calling sendMessage #2411

Closed AndrewTran2018 closed 1 year ago

AndrewTran2018 commented 1 year ago

@levlam @kossnocorp Hi team,

I'm trying to sendMessage in the case of broken network but to ensure reliablity , and the results are different. Sometimes the messages were sent out successfully, sometimes only the last message is ok, sometimes nothing is ok, some cases tdlib is too slow to recover, some case it recovers fast. So my question is what is the exact behavior (design) to do in case of the client is offline.
My TdlibParameters: useTestDc: false, useSecretChats: false, useMessageDatabase: true, useFileDatabase: true, useChatInfoDatabase: true, ignoreFileNames: true, enableStorageOptimizer: true,

        I know tdlib fires up the so called UpdateConnectionState. Has it been designed for this case? 

        Many thanks.
levlam commented 1 year ago

If message database is used, then TDLib guarantees that the message will be sent if there will be access to the network within 24 hours.

AndrewTran2018 commented 1 year ago

@levlam Thank you for making it clear. I addressed this issue, totally it is on our code handling it. Close it now. Thanks. Notes: tdlib appears a bit slow on its recovery after the connection is being restored.

levlam commented 1 year ago

@AndrewTran2018 TDLib optimizes battery usage if the user is offline. You need to set "online" option to true if the user is online for faster recovery. Also, app can call setNetworkType whenever it knows that network is appeared or disappeared for immediate recovery.

AndrewTran2018 commented 1 year ago

@AndrewTran2018 TDLib optimizes battery usage if the user is offline. You need to set "online" option to true if the user is online for faster recovery. Also, app can call setNetworkType whenever it knows that network is appeared or disappeared for immediate recovery.

Thank you, I apply the trick of SetNetworkType, need to verify later. Cheers!

@levlam