M
M
Michael2020-07-22 13:45:50
Python
Michael, 2020-07-22 13:45:50

Telebot how best to design the architecture?

Hello, the essence of the task is this: I need, within the framework of one bot, to set up connectivity between the hosts that raise it.

In the basic implementation of the bot, it is impossible to simultaneously connect to the bot from different hosts, only one active connection, and I need one bot to be able to interact with the operating system on which it is running, and there may be several such systems.
- Creating a bot for each system is not an option, since there is a need for access through one bot, but for example by different people, to different hardware. That is, my task is to implement host management using one channel, and the business logic will process different clients for different hosts.

So far, I see only such an implementation: create a bot for each host, and one central bot that will manage the rest depending on the client. But it seems to me that this approach is too cumbersome, is it really impossible to use an asynchronous socket to access the bot? What would he listen to all connected machines that raise the connection? Or I misunderstand something, most likely) do not throw your slippers please)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-07-24
@moonz

Is it really impossible to use an asynchronous socket to access the bot? What would he listen to all connected machines that raise the connection?

It is not clear which connected machines the bot should listen to, do you mean api telegram? Read what is long polling and webhook. You can send messages on behalf of one bot from at least 100 machines using one token. This telegram will report events to only one machine. The bot can work without polling or hooks, only for outgoing messages.
If you completely pervert, you can set up telegram hooks on one server, accept a request there and put it in which thread message broker, pub / sub, streaming .... subscribe to this stream on all servers and process these requests as if they came directly from the telegram (putting update into the dispatcher .. or I don’t know how it is implemented specifically in this library). Replying with the same token.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question