如何将sid添加到XMPPBOSHConnection?

时间:2015-04-05 13:02:34

标签: android smack

我无法连接到我的bosh服务器,它说它需要" sid":

  

org.igniterealtime.jbosh.BOSHException:Connection Manager会话创建响应未包含必需的' sid'属性

这就是我尝试连接/登录的方式:

        BOSHConfiguration.Builder configBuilder = BOSHConfiguration.builder();
        configBuilder.setUsernameAndPassword(USERNAME, PASSWORD);
        configBuilder.setHost(HOST);
        configBuilder.setPort(PORT);
        configBuilder.setFile(FILE_PATH);
        configBuilder.setUseHttps(true);
        configBuilder.setServiceName(SERVICE);
        AbstractXMPPConnection connection = new XMPPBOSHConnection(configBuilder.build());
  

尝试{                   connection.connect();               } catch(SmackException e){

1 个答案:

答案 0 :(得分:0)

我遇到同样的问题并在我添加以下代码时解决了:

Bytestream stream = new Bytestream();
stream.setSessionID(username);
configBuilder.setResource(stream.toXML().toString());