gramjs icon indicating copy to clipboard operation
gramjs copied to clipboard

Extreme delay when receiving messages

Open BytePhoenixCoding opened this issue 1 year ago • 2 comments

I'm getting extremely delay when receiving messages on my nodeJS bot after they've been broadcasted.

My code is:

telegramClient.addEventHandler(async (event) => { await processChannelMessage(event, "-100" + event.message.peerId.channelId.toString()); }, new NewMessage({chats: telegramChannels}));

The delay is variable but usually from between 10 seconds to around 40 seconds. Sometimes messages from channels I'm subscribed to come instantly however (<1 sec).

I checked message.date and it's the exact time that the message was posted (reading from Telegram desktop).

Is this a known issue? Is it gramjs's problem or TG servers / API? I've tried it on my home PC which has good internet (50mbps) and also done it on an AWS VM with same issue.

Is there anything else I can try to improve it? Cheers.

BytePhoenixCoding avatar Jul 20 '23 13:07 BytePhoenixCoding

Do these channels have a lot of members ? it's known that telegram will send messages with some delay in huge channels unless you "show interest" in them.

painor avatar Jul 20 '23 14:07 painor

Do these channels have a lot of members ? it's known that telegram will send messages with some delay in huge channels unless you "show interest" in them.

Hmm maybe you're onto something. I notice that with using my own channels (1/2 subs) the msgs get processed almost instantly. However the channels I'm interested in have 10k+ subs. Is there any info on this delay, how to 'show interest'? Cheers!

BytePhoenixCoding avatar Jul 20 '23 15:07 BytePhoenixCoding