Включить управление потоками xmpp connection smack 4.1
Я попытался включить управление потоком (XEP-0198) с помощью этого куска кода
XMPPTCPConnectionConfiguration connConfig = XMPPTCPConnectionConfiguration.builder().setHost(HOST)
.setPort(PORT).setDebuggerEnabled(true).setSecurityMode(SecurityMode.disabled)
.setUsernameAndPassword(USERNAME, PASSWORD).setServiceName(SERVICE).build();
XMPPTCPConnectionconnection = new XMPPTCPConnection(connConfig);
connection.setPacketReplyTimeout(TIME_OUT);
connection.connect();
connection.login();
connection.setUseStreamManagement(true);
Но позже, когда я проверяю управление потоком, он возвращает false.
1 ответ
Решение
Я думаю, вам нужно настроить управление потоком перед подключением к xmpp.
XMPPTCPConnectionConfiguration connConfig = XMPPTCPConnectionConfiguration.builder().setHost(HOST)
.setPort(PORT).setDebuggerEnabled(true).setSecurityMode(SecurityMode.disabled)
.setUsernameAndPassword(USERNAME, PASSWORD).setServiceName(SERVICE).build();
XMPPTCPConnectionconnection = new XMPPTCPConnection(connConfig);
connection.setUseStreamManagement(true);
connection.setPacketReplyTimeout(TIME_OUT);
connection.connect();
connection.login();