简体   繁体   中英

how to create chat room using smack API in java programatically

I'm trying to create a Chatroom using SMACK API for java programmatically for a Java Application. It doesn't show any error but no rooms are getting created.

Following is the code :

MultiUserChat oMultiUserChat = new MultiUserChat(connection,"test_open_house@example.com");
        try {
            oMultiUserChat.create("test_open_house");
              oMultiUserChat.sendRegistrationForm(new Form(Form.TYPE_SUBMIT));
            oMultiUserChat.join("example");
                    } catch (XMPPException e) {
            e.printStackTrace();
        }

Using this The chat room isn't getting created. Connection is established succesfully.

MultiUserChat muc = new MultiUserChat(Connection, roomName +"@conference." + Domain);    
         muc.create("UserNickName");
         muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

dont forget to include the service name eg conference in this case What server are you using? if you are using openfire the service name must me conference. and it should be like this: test_open_house@.conferece.example.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM