tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Mutliple Client on Springboot java #3020

Closed jonnjonnjo closed 2 months ago

jonnjonnjo commented 2 months ago

I planned to create a springboot application in which could hold multiple tdlib client ( because AFAIK, each client could only hold 1 acount ). this springboot will "act" as a bridge of my another application ( let's say that app is called app A ). App A could be logged in by several account. each account will send http request to my springbootapp based on according what they need ( such as sending messages, see list of chats, and etc ).

In other words, my springboot app will take many HTPP requests from many users, and do many telegram task from my app. Here's the example.

User B and C has different telegram account. The springboot could do this

  1. B authenticate its number
  2. C authenticate its number
  3. B sending message to D
  4. C wants to get list of chats

all of that could be done sequencially. So, we have to create multiple clients inside the springboot app. Is that a good way to do that? or is there any other better way than that ?

levlam commented 2 months ago

It is correct to create multiple clients to support multiple users.

abhishek-jainm commented 2 months ago

You don't need to create multiple client, just create client_details table and stored all type of client. When you hit the api just send clientId in the header or params according to your requirement and make one filter method, who will verify the clientId and then call the api.

jonnjonnjo commented 2 months ago

where could i read more about the client_details table? i don't see it in https://core.telegram.org/tdlib/docs/