NewMessage event not working for majority of channels all of a sudden
Hi,
I am subscribed to 20+ Telegram channels and I was receiving all new messages until 2 days back without any issues.
Since Yesterday, I am not receiving message for NewMessage event for most of the channels. I didn't make any changes in the code.
I am only receiving this for 1-2 channels and not others. On Telegram app, I can see messages on almost all channels.
I am using below line of code for subscribing to all new messages -
client.addEventHandler(eventFunction, new NewMessage({}));
Any idea if Telegram updated something at their end?
thanks.
I thought that I messed something in the code, but it looks like it's genereral problem. btw. it looks like a problem with channels with huge number of subscribers. Small channels are being triggered like before
Yes, correct. In my case, I am getting messages through event for channels with subscriber count around 1000 but not for channels with subscriber count more than 30000.
Couple of minutes ago I've received event from huge channel. Maybe some hickup on telegram end? I'm going to monitor the behavior.
The same here
can confirm, this happened to me as well.
So I've noticed that connection was established using Layer 159 which is kinda outdated?
So what I've done: Tried to do hard reinstall of the library by
- removing it with
npm remove telegramand - reinstalling back with
npm install telegram
Now logs say Layer 179 is used for connecting. All of a sudden got a message from the channel with 25k+ subscribers.
Tested out (not too extensively though)
So update your lib to "telegram": "^2.21.2" to test it out.
Fixed the issue for me with no code changes.
can confirm, this happened to me as well.
So I've noticed that connection was established using Layer 159 which is kinda outdated?
So what I've done: Tried to do hard reinstall of the library by
- removing it with
npm remove telegramand- reinstalling back with
npm install telegramNow logs say Layer 179 is used for connecting. All of a sudden got a message from the channel with 25k+ subscribers.
Tested out (not too extensively though)
So update your lib to
"telegram": "^2.21.2"to test it out.Fixed the issue for me with no code changes.
Still not working for me...
I was running into the same issue. When I started up my program, I would receive new messages for my large channels but after about 2 minutes it would stop.
One day I left the program running anyways, and then after about 10-20 minutes I noticed a timeout error in my logs and started receiving new messages again. I tracked down the timeout to here https://github.com/gram-js/gramjs/blob/5a0f45b2b5f30472634d9948cbc404b09b54e0c7/gramjs/client/updates.ts#L245-L260
so something in there seemed to kickstart the ability to receive messages again.
using that, I implemented an interval to just call the same reconnect method as at the bottom of that error handler.
setInterval(async () => {
client._sender?.reconnect();
}, 1000 * 60);
bit of a hack. seems like it's possible to end up missing messages, but for my purposes seems to work so far.
Hope it works for others.
same here also, the workaround proposed by @nickuya does not work as reconnects are never successful for some reason version 2.26.7 layer 193
Experiencing same issue. With some messages it works flawlessly, with some NewMessage event is never triggered.
I'v been experiencing this same issue the last two days, did anyone managed to fix it ?
Any update on this? facing same, suddenly stopped receiving events
Same
bump, same here