Package it.ernytech.tdlib
Class Client
- java.lang.Object
-
- it.ernytech.tdlib.Client
-
public class Client extends java.lang.Object
Interface for interaction with TDLib.
-
-
Constructor Summary
Constructors Constructor Description Client()
Creates a new TDLib client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroyClient()
Destroys the client and TDLib instance.Response
execute(Request request)
Synchronously executes TDLib requests.Response
receive(double timeout)
Receives incoming updates and request responses from TDLib.java.util.List<Response>
receive(double timeout, int eventSize)
Receives incoming updates and request responses from TDLib.void
send(Request request)
Sends request to TDLib.
-
-
-
Method Detail
-
send
public void send(Request request)
Sends request to TDLib. May be called from any thread.- Parameters:
request
- Request to TDLib.
-
receive
public java.util.List<Response> receive(double timeout, int eventSize)
Receives incoming updates and request responses from TDLib. May be called from any thread, but shouldn't be called simultaneously from two different threads.- Parameters:
timeout
- Maximum number of seconds allowed for this function to wait for new data.eventSize
- Maximum number of events allowed in list.- Returns:
- An incoming update or request response list. The object returned in the response may be an empty list if the timeout expires.
-
receive
public Response receive(double timeout)
Receives incoming updates and request responses from TDLib. May be called from any thread, but shouldn't be called simultaneously from two different threads.- Parameters:
timeout
- Maximum number of seconds allowed for this function to wait for new data.- Returns:
- An incoming update or request response. The object returned in the response may be a nullptr if the timeout expires.
-
execute
public Response execute(Request request)
Synchronously executes TDLib requests. Only a few requests can be executed synchronously. May be called from any thread.- Parameters:
request
- Request to the TDLib.- Returns:
- The request response.
-
destroyClient
public void destroyClient()
Destroys the client and TDLib instance.
-
-