danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.76k stars 619 forks source link

How to determine that a session has been disconnected from another telegram client? #1423

Closed psqq closed 9 months ago

psqq commented 9 months ago

Let's say I connected a number using a code in MadelineProto and then disconnected this session in another client.

How to determine that a session was disconnected in another client?

How can I fix the session created in MadelineProto so that I can reconnect the number again?

mtalaeii commented 9 months ago

This project is build for good reasons switching between 2 sesssions or connect and disconnect from session is one of reasons that vaiolate telegram TOS. Thats why we have ipc here and tou cant do that after login and start the but the only reason can fully stop the but use stop method in event handler or stop process if you using Rest mode

danog commented 9 months ago

start() automatically checks if the session is logged in/was logged out and shows a login prompt if it's not logged in. getAuthorization() may also be used.