Closed whyoleg closed 5 years ago
No, unless it will have an interface similar to Client. Why do you want it?
I'm working on library for Kotlin and in future, want to use kotlin MPP with native(c/c++/obj-c/swift) and js(webasm) implementations.
In Client implementation there is a restriction, that receive
method can be called only from one thread simultaneously. As I understand, this restriction is for full tdlib instance, or may be I'm wrong and it per client restriction?
So in my assumption, I need to add an additional synchronization (on top of that which already exists in Client) to handle multiple users/clients (if it will be used as a server with 100, 1000, etc users).
Also I've read in one of issues here, that ClientActor is faster than Client, and bot api based on ClientActor. So I want to archive maximum performance if possible.
It is a per-client restriction. You may treat different Clients as completely independent.
The only downside of Client interface is that you need a per-client thread to call Client.receive
. It's not a big problem if you need up to 100-1000 Clients simultaneously.
Big thx for clarification this part! But, anyway, it will be also good to somehow use ClientActor, will it be possible in future? Or even somehow now with additional C++ glue code?
It is not possible to directly wrap ClientActor
using JNI.
To trade some usage simplicity for some performance, the Client
class needs to be replaced with some other class, which will also use ClientActor
internally and can be used from other languages.
But this is very unlikely to be needed. because performance of Client
class should be enough for almost any application. Threads waiting for updates in Client.receive
should consume almost zero system resources, and this is the only thing that could be optimized more in the Client
interface.
Thx, will keep in mind!
Is it possible to somehow create low level JNI for ClientActor?