telegram-s / telegram-api-old

Telegram Api library for java
MIT License
138 stars 64 forks source link

API Timeouts #21

Open anvaya opened 10 years ago

anvaya commented 10 years ago

We are stuck on API after the sign in process. We are able to issue Send Code, Sign in, but after that all calls get timed out. What are we doing wrong and how can we get past this ?

Here is the sample code we are using:

TLRequestAuthSignIn info = new TLRequestAuthSignIn(PHONE_NO, phone_hash, auth_code);

                TLAuthorization auth = api.doRpcCallNonAuth(info, 120*1000, dc_id);                
                System.out.println("Logged in " + auth.getUser().getId());                                                                           

// WORKS OK TILL THIS PART //NOW THE TIMEOUT PRObLEM

                long msg_id = (long) (Math.random() * 2 * Long.MAX_VALUE - Long.MAX_VALUE);

                TLInputPeerContact peer = new TLInputPeerContact(CONTACT_ID);
                TLRequestMessagesSendMessage msg = new TLRequestMessagesSendMessage(peer, "Message from Java Client", msg_id);
                TLObject msg_result = api.doRpcCall(msg, 60*1000);
                if(msg_result instanceof TLAbsSentMessage)
                {
                    TLAbsSentMessage sent = (TLAbsSentMessage) msg_result;
                    System.out.println("Message Sent: ID " + sent.getId());
                }
                else if (msg_result instanceof TLAbsStatedMessage) 
                {
                    TLAbsStatedMessage sent = (TLAbsStatedMessage) msg_result;                                
                    System.out.println("Message Stated");
                }
                else
                {
                    TLAbsStatedMessages sent = (TLAbsStatedMessages) msg_result;                            
                    System.out.println("Message Stated 2");
                }
                return;
marchagele commented 10 years ago

same problem here

jmoral commented 10 years ago

if you use linux, see https://github.com/ex3ndr/telegram-api/issues/9

Raakh commented 8 years ago

Can you please send me compiled working code to my email ghayel@gmail.com? I shall be grateful to you