简体   繁体   English

如何在Java中使用smack API创建聊天室

[英]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. 我正在尝试使用Java的SMACK API为Java应用程序创建一个Chatroom。 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. 如果您使用的是openfire,则服务名称必须为我。 and it should be like this: test_open_house@.conferece.example.com 它应该是这样的:test_open_house @ .conferece.example.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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