1

I'm using mtproto-core (https://github.com/alik0211/mtproto-core) from a Vue application to interact with Telegram API.

Everything works fine except when I try to get updates, I followed the example code but it just doesn't work.

Any help will be appreciated.

mtproto.updates.on('updateShort', message => {
  const { update } = message;

  if (update._ === 'updateUserStatus') {
    const { user_id, status } = update;

    console.log(`User with id ${user_id} change status to ${status}`);
  }
});
J. Fer
  • 21
  • 1

1 Answers1

3

Sadly you have to poll updates.getState every n seconds if you want to receive updates.

So something like this:

setInterval(() => mtproto.call('updates.getState', {}), 3000)
ArniqueMK
  • 69
  • 2