GithubHelp home page GithubHelp logo

Multiple accounts about td HOT 13 CLOSED

tdlib avatar tdlib commented on April 30, 2024
Multiple accounts

from td.

Comments (13)

RememberTheAir avatar RememberTheAir commented on April 30, 2024 19

I love when you think you might get something out of a conversation and suddenly everyone starts to write in their mother language like

from td.

levlam avatar levlam commented on April 30, 2024 10

One TDLib Client can manage only one account, but there is no limit on number of clients that can be created in one process. So you can create as much TDLib Clients as you want and initialize them with different database and file folders for different accounts.

from td.

DerAlSem avatar DerAlSem commented on April 30, 2024 8

from td.

DerAlSem avatar DerAlSem commented on April 30, 2024

Is there a reason for this method not to work? I mean, see i run first instance, let's say phone_number is 111222, here's tdlib parameters:

(
[use_test_dc_] => 1
[database_direcotry] => /home/tdlib/storage/111222/db
[files_directory] => /home/tdlib/storage/111222/files
[use_message_database] => 1
[use_file_database] => 1
)

if i try to run second instance with phonenumber 333444, i'm getting this:

(
[use_test_dc_] => 1
[database_direcotry] => /home/tdlib/storage/333444/db
[files_directory] => /home/tdlib/storage/333444/files
[use_message_database] => 1
[use_file_database] => 1
)

after 3-5 seconds:

(
[@type] => error
[code] => 400
[message] => Can't lock file because it is already in use; check for another program instance running
)

from td.

levlam avatar levlam commented on April 30, 2024

@DerAlSem You have misprint in "database_direcotry", so the database directory isn't specified at all and current directory is used. TDLib noticed that and refused to open the same database twice.

from td.

DerAlSem avatar DerAlSem commented on April 30, 2024

Unbelievably stupid typo.
Thanks pal!

from td.

SavostinVladimir avatar SavostinVladimir commented on April 30, 2024

Hi!
Is there way to store multiple sessions in arbitrary storage (without database_directory and file_directory) with tdlib_json_client?

from td.

DerAlSem avatar DerAlSem commented on April 30, 2024

from td.

SavostinVladimir avatar SavostinVladimir commented on April 30, 2024

No, I meant to store data in postgres for example

from td.

levlam avatar levlam commented on April 30, 2024

@SavostinVladimir This isn't possible. You can't change a way the data is stored by TDLib.

from td.

SavostinVladimir avatar SavostinVladimir commented on April 30, 2024

Я хочу хранить именно сессии. Допустим у меня 100500 разных пользователей и я не хочу их постоянно логинить через телефон и код. Мне надо хранить в постгрес данные всех этих 100500 сессий. Но в tdlib, эту заботу на себя берёт td_json_client, храня все что связано с пользователем в отдельной директории. Но создавать кучу директорий для каждого отдельного пользователя мне не подходит.
Пробовал поискать библиотеки реализующие mtproto, но там тоже максимум что я нашёл - это сохранить одну сессию в файлик. Единственное что приходит в голову пока, это немного поменять реализацию такой библиотеки под себя (чтобы сессия могла загружаться/выгружаться в постгрес)

from td.

DerAlSem avatar DerAlSem commented on April 30, 2024

from td.

SavostinVladimir avatar SavostinVladimir commented on April 30, 2024

Проблема в том что у меня куча микросервисов которые должны работать с этими базами, если они на одной машине то все норм. А если расширяться на несколько машин, то и все базы надо расшаривать. Именно поэтому хотелось бы найти вариант самому хэндлить сессии. Тогда я мог бы класть все в единственный инстанс постгрес, а остальные обращались бы к нему

from td.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.