I am having lots of trouble with XMPP, I am new to it and all the examples that I have found already have an account with which they connect and then do things.
My problem concerns new users. Someone who does not have an account needs to be able to register himself and then log in. But as I have understood, you first need to create a connection before you can create users. So without an account you can not create one.
some links I have been reading:
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
XMPPConnection connection = new XMPPTCPConnection(config);
Creating an account works by first connecting to the server and then initializing the account creation. Essentially, you create a connection in which you can create an account, and then proceed to create said account. Here's how I do it:
XMPPTCPConnectionConfiguration conf = XMPPTCPConnectionConfiguration.builder() .setServiceName(SERVICE_NAME) .setHost(HOST_NAME) .setPort(5222) .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled) .build(); AbstractXMPPConnection connection = new XMPPTCPConnection(conf); connection.connect(); // Here we create the connection // Now we create the account: AccountManager accountManager = AccountManager.getInstance(connection); accountManager.createAccount(username, password); // The account has been created, so we can now login connection.login(username, password);
So we first initialized the connection, created the account, and then logged in. Hopefully this helps