RpcCall timeout's / exceptions
Hi
I fail to do RpcCall's after authorization and was hoping anyone can help me out.
My authorization:
public void authSendCode() {
api.doRpcCallNonAuth(new TLRequestAuthSendCode(PHONE_NUMBER, 0, ApiConfig.API_ID, ApiConfig.API_HASH, "en"), REQUEST_TIMEOUT,
new RpcCallback<TLSentCode>() {
@Override
public void onResult(TLSentCode result) {
phone_hash = result.getPhoneCodeHash();
authSignIn();
}
@Override
public void onError(int errorCode, String message) {
if (errorCode == 303) {
String split[] = message.split("_");
int destDC = Integer.parseInt(split[split.length-1]);
api.switchToDc(destDC);
authSendCode();
return;
}
}
});
}
public void authSignIn() {
Scanner scanner = new Scanner(System.in);
phone_code = scanner.nextLine();
api.doRpcCallNonAuth(new TLRequestAuthSignIn(PHONE_NUMBER, phone_hash, phone_code), REQUEST_TIMEOUT,
new RpcCallback<TLAuthorization>() {
@Override
public void onResult(TLAuthorization result) {
System.out.println("AUTH SIGN IN RESULT !!!!");
getDialogs();
}
@Override
public void onError(int errorCode, String message) {
}
});
}
Until here it works. I can see the "AUTH SIGN IN RESULT !!!!" in console. But this doesn't work:
public void getDialogs() {
try {
TLAbsDialogs dialogs = api.doRpcCall(new TLRequestMessagesGetDialogs(0, 0, 10));
for(int i = 0; i < dialogs.getMessages().size(); i++) {
TLAbsMessage absMessage = dialogs.getMessages().get(i);
ChatMessage msg = Utils.convertMessage(absMessage);
System.out.println("MESSAGE: " + msg.getMessage());
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
I never get at the for loop, I'm stuck at this:
TLAbsDialogs dialogs = api.doRpcCall(new TLRequestMessagesGetDialogs(0, 0, 10));
I let it run for some time and this is the console log: http://pastebin.com/4jThzHuK The "AUTH SIGN IN RESULT !!!" is at line 462. After that I request the dialogs but I get exceptions.
Do you have linux JVM?
I develop on windows but my application will have to run on a linux server when it's finished.
I updated to telegram-api-1.1.127-shadow.jar. I can't do anything anymore. Everytime I get errorcode 0. Also on TLRequestHelpGetConfig.
Code:
Application: http://pastebin.com/0bidY3vs ApiState: http://pastebin.com/BLpaSVL5 Log: http://pastebin.com/7pN3sWfN
Also: "The RPC calls" under "Usage of library" doesn't match with the code.
If I work without the callbacks I get a little bit further but after calling api.switchToDc I get a nullpointer from the ActorySystem class.
Code: http://pastebin.com/a78EsBGp Exception: Exception in thread "main" java.lang.NullPointerException at org.telegram.actors.ActorSystem.close(ActorSystem.java:97) at org.telegram.mtproto.MTProto.close(MTProto.java:221) at org.telegram.api.engine.TelegramApi.switchToDc(TelegramApi.java:161) at TelegramApplication.authSendCode(TelegramApplication.java:62) at TelegramApplication.updateDatacenters(TelegramApplication.java:45) at TelegramService.run(TelegramService.java:9) at TelegramService.main(TelegramService.java:4)
I find it strange that with using callback functions it doesn't work but without using callbacks it does.
I switched back to an older api version (commit from 24/03/2014), so the same version I was using in my first post. I also found why it didn't work. I never called: api.getState().setAuthenticated(api.getState().getPrimaryDc(), true); After authorization
Hi,
We are stuck on the same thing. As per your suggestion added the setAuthenticated call. Still no luck.
Will try the old version, did you get any further ?
We do not mind paying if you can join us as a consultant getting this done.
Have the exact same problem. Auth works, and when I call some doRpcCall then it throws timeout exception. But it throws directly, no waittime or something.
On the state I am setting setAuthenticated but...just getting timeout. PD: just tried on Testnet not on production ip's
Hi can anybody send me compiled working code? I shall be thankful to you from the bottom of my heart. My email is [email protected]
Hi guys. The same problem on calling TLRequestMessagesGetDialogs() and TLRequestMessagesGetPeerDialogs() ... 😒
Did someone solve this?
@ghost @anvaya @po0kie @ex3ndr