Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TdLib for server side (with storing multiple account sessions) #718

Closed
influento opened this issue Oct 2, 2019 · 4 comments
Closed

TdLib for server side (with storing multiple account sessions) #718

influento opened this issue Oct 2, 2019 · 4 comments

Comments

@influento
Copy link

Hello,

Actually I'm trying to build server based app where the logic is that multiple users should be able to connect their telegram account to my application.

I got from here #40 that we should create one database per account. But, which logic I should use to work with database which corresponds to concrete user? For example server gets request to retrieve first 10 chats of user with phone P1 (I guess the best way is to use phone number as user identifier). And lets assume that we already created session for user with phone P1. How tdlib client on server side can know that currently he should use session for user with phone P1?

Also is that possible to check if tdlib created session for user with concrete phone? Or in another words is that possible to get current AuthorizationState based on phone?

Thanks for your help!

@levlam
Copy link
Contributor

levlam commented Oct 2, 2019

TDLib doesn't manage multiple accounts itself. So you will need to create a directory for each phone number, i.e. phonenumber123456789, and initialize a TDLib instance with that directory as database and files directory. After TDLib instance is created it will send you updateAuthorizationState, which can be handled by your application.

@influento
Copy link
Author

Ok, thanks

@deewelop
Copy link

deewelop commented Mar 6, 2022

and where we have to give it database directory path?
little help pls <3

@deewelop
Copy link

deewelop commented Mar 6, 2022

found it, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants