Closed danny1ng closed 2 years ago
I'm sorry but I don't understand what you mean.
the connection is tied to the client object. if you create a new TelegramClient you are creating a new connection.
if you want to have multiple connections maybe put the clients inside an array?
@painor i have express app which find message in telegram channel and i want run 1 app for one channel and 2 app on another chanel. i need run telegram in different terminals . Array not suits me.
I don't see the issue then. if you have multiple running clients on different terminals it shouldn't be a problem
I don't see the issue then. if you have multiple running clients on different terminals it shouldn't be a problem
i recorded video with issues https://monosnap.com/file/d1wm4zvDI0Zltr0WXO7rnWBB3xG0n9
you can't run the same session multiple times. Telegram will only send updates to the latest running client.
if you want to receive updates you'll need a new session for each client (even if it's the same account).
can I save the connection to the database and work with the client without connecting? I see that the client is different before and after the connection.
in this example https://github.com/abdhass/telegram-channel-scraper/blob/master/utils/init.js in another library I see a storage where your connection is saved, and you can work with 1 session and make multiple connections
GramJS returns a SessionString that you can save in your DB if you want.
you can use the same session string in the same IP to send messages
You would need a different session string if you want to receive messages/updates. it's a telegram limitation
okay thank
I have code like this.
When i run this code on express server in different por only work last telegram. That is, the last running one always works, the previous ones do not work. It feels like the new connection is killing the old one. How to solve the problem with multi-connection?