Not able to receive XMPPPubsub events to node subscribers - ios

I am developing an app like RSS Feeds. I want users to get feeds without calling any web service. I read out some documents and got a solution of using XMPP where XMPPPubsub gives us that functionality to send an event notification to all subscribers.
In XMPPPubsub Owner creates a node and other users who want to get event notification subscribes to that node.
Set up XMPPPubsub
XMPPJID *serviceJID =[XMPPJID jidWithString:[NSString stringWithFormat:#"pubsub.%#",HOST_NAME]];
_xmppPubSub = [[XMPPPubSub alloc]initWithServiceJID:serviceJID dispatchQueue:dispatch_get_main_queue()];
[_xmppPubSub addDelegate:self delegateQueue:dispatch_get_main_queue()];
[_xmppPubSub activate:_xmppStream];
Creation of Node
- (void)createNodeWithName:(NSString*)nodeName withCompletionHandler:(CreateNodeCompletionHandler)completionBlock{
_createNodeCompletionHandler = completionBlock;
[_xmppPubSub createNode:nodeName withOptions:#{#"pubsub#title":nodeName,#"pubsub#deliver_notifications":#"1",#"pubsub#deliver_payloads":#"0",#"pubsub#persist_items":#"1",#"pubsub#notify_sub":#"1",#"pubsub#subscribe":#"1",#"pubsub#send_last_published_item":#"When a new subscription is processed and whenever a subscriber comes online",#"pubsub#access_model":#"open",#"pubsub#presence_based_delivery":#"1",#"pubsub#publish_model":#"open"}];
}
User who wants to have events must subscribe to node
- (void)subScribeToNode:(NSString*)nodeName withCompletionHandler:(SubscribeNodeCompletionHandler)completionBlock{
_subscribeNodeCompletionHandler = completionBlock;
[_xmppPubSub subscribeToNode:nodeName withJID:_xmppStream.myJID options: #{ #"pubsub#deliver" : #(YES),
#"pubsub#digest" : #(YES),
#"pubsub#include_body" : #(YES),
#"pubsub#show-values" : #[ #"chat", #"online", #"away" ] }];
}
Publish the event to node
- (void)sendMessage:(NSString*)message ToNode:(NSString*)node{
NSXMLElement *body = [NSXMLElement elementWithName:#"body"];
[body setStringValue:message];
NSXMLElement *messageBody = [NSXMLElement elementWithName:#"message"];
[messageBody setXmlns:#"jabber:client"];
[messageBody addChild:body];
[_xmppPubSub publishToNode:node entry:messageBody withItemID:nil options:#{#"pubsub#access_model":#"open"}];
}
All is working well Users are able to subscribe to a node. We are able to create the Node. When we get our subscriber nodes, it also returns all the nodes. The events that we published are also there in Database and if I retrieve events by code it also returns all of them.
But the issue is the subscribers are not able to get its notification in didReceiveMessage so subscribers are not getting notified of events.
No logs in below functions
- (void)xmppPubSub:(XMPPPubSub *)sender didReceiveMessage:(XMPPMessage *)message{
NSLog(#" -----We Just Received message wooo hooo whow owowhwo -----");
}
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq{
return YES;
}
Please guide me through this what I am doing wrong in it.
Thanks in Advance.

Client should indicate he wishes to receive notifications, as described in XEP-0060
In XMPPFramework you need to implement XMPPCapabilitiesDelegate and add younodename+notify to client capabilities. E.g. in your XMPPModule you need the following:
- (BOOL)activate:(XMPPStream *)aXmppStream
{
if ([super activate:aXmppStream])
{
[xmppStream autoAddDelegate:self delegateQueue:moduleQueue toModulesOfClass:[XMPPCapabilities class]];
return YES;
}
return NO;
}
- (NSArray *)myFeaturesForXMPPCapabilities:(XMPPCapabilities *)sender
{
return #["myprotocolnode+notify"];
}

Related

iOS XMPP PubSub not receiving events while publishing node to my subscribed users

I am using XMPPClient with ejjaberd for my chat application(like Whatsapp). I want to implement XMPPPubsub to notify all users when any one of user changed his/her profile picture.
My framework : https://github.com/robbiehanson/XMPPFramework
Here is my code
Initialize XMPPPubsub
XMPPJID *serviceJID =[XMPPJID jidWithString:[NSString stringWithFormat:#"pubsub.%#",[[SharedClass sharedInstance] hostName]]];
_xmppPubSub = [[XMPPPubSub alloc]initWithServiceJID:serviceJID dispatchQueue:dispatch_get_main_queue()];
[_xmppPubSub addDelegate:self delegateQueue:dispatch_get_main_queue()];
[_xmppPubSub activate:xmppStream];
To create node :
NSString *nodeName =[[NSUserDefaults standardUserDefaults] valueForKey:#"kmobileNo"]; // logged in user or current user
[[[XmppClient sharedInstance] xmppPubSub] createNode:nodeName withOptions:#{#"pubsub#title":nodeName,#"pubsub#deliver_notifications":#"1",#"pubsub#subscribe":#"1",#"pubsub#presence_based_delivery":#"1",#"pubsub#publish_model":#"open",#"pubsub#access_model":#"open",#"pubsub#persist_items":#"1",#"pubsub#notify_sub":#"1",#"pubsub#deliver_payloads":#"1"}];
To subscribe users
for (Contact *obj in arrayUsers) {
NSLog(#"elsa user %#",obj.phoneNumber);
[[XmppClient sharedInstance].xmppPubSub subscribeToNode:obj.phoneNumber withJID:[XmppClient sharedInstance].xmppStream.myJID options: #{ #"pubsub#deliver" : #(YES),
#"pubsub#digest" : #(YES),
#"pubsub#include_body" : #(YES),
#"pubsub#show-values" : #[ #"chat", #"online", #"away" ] }];
}
To publish events :
NSString *nodeName =[[NSUserDefaults standardUserDefaults] valueForKey:#"kmobileNo"];
NSXMLElement *body = [NSXMLElement elementWithName:#"body"];
[body setStringValue:#"String to post"];
NSXMLElement *messageBody = [NSXMLElement elementWithName:#"message"];
[messageBody setXmlns:#"jabber:client"];
[messageBody addChild:body];
[[[XmppClient sharedInstance] xmppPubSub] publishToNode:nodeName entry:messageBody withItemID:nil options:#{#"pubsub#access_model":#"open"}];
My problems are
I am not receiving events on below delegate , when user publish node to my subscribed users
-(void)xmppPubSub:(XMPPPubSub *)sender didReceiveMessage:(XMPPMessage *)message
{
NSLog(#"Message %#",message);
}
But I am getting those all events correctly on above delegate when I create my node. I am creating my node after initialise pubsub. So I am getting all my events when I launch my app Because I am initializing pubsub on Appdelegate.
also I am receiving same events continously whenever I launch app. For example , If I have event(profile pic changed) to be received then I will get it on "didReceiveMessage" on launch of application. I will get the same on next every launches.
I want to get events on "didReceiveMessage" delegate when someone publish to my subscribed users(when user change profile picture) , not when launch app(when create node).
How to get all users who are all subscribed by me. ?
3.How to know node is already created with my number ?
4.I want to know why I am getting events when creating node instead of when user publish to node ?
5.Why I am receiving same events again and again whenever I create node ?
Please help me . Thanks in advance.

Xmpp MultiUserChat (MUC) Group Does not remain stable

I created an Xmpp Chat App where I have implemented the one-to-one and group chat.
The Chat itself is working fine.
The issue is in Group chat. I created a group with 2-3 members, again the chat is working fine, but when I kill the application and restart it, I'm not getting the group messsages from any of the groups I have created.
while I am connected to the XMPP Server and re-join any group then I get the messages.
My problem is that I have to join into groups again every time after I kill the app completly.
Please let me know How I can get the messages or join automatically in group when i open the application from killed state.
You need to send presence to XMPP server once your application launched or come out from background. so the XMPP server understand that respective group is ready to handle event.
Edit : you can send presence using following code.
- (void)goOnline {
NSXMLElement *presence = [NSXMLElement elementWithName:#"presence"];
NSXMLElement *show = [NSXMLElement elementWithName:#"show"
stringValue:#"dnd"];
NSXMLElement *status = [NSXMLElement elementWithName:#"status" stringValue:#"available"];
NSXMLElement *priority = [NSXMLElement elementWithName:#"priority" stringValue:#"24"];
[presence addChild:show];
[presence addChild:status];
[presence addChild:priority];
[_xmppStream sendElement:presence];
[self createOrJoinRoom];
}
- (void)createOrJoinRoom {
if ([appDelegate.xmppStream isConnected]) {
NSString *myJID = [[NSUserDefaults standardUserDefaults] stringForKey:#"XMPPUserId"];
NSXMLElement *presence = [NSXMLElement elementWithName:#"presence"];
[presence addAttributeWithName:#"from" stringValue:[[appDelegate.xmppStream myJID]full]];
[presence addAttributeWithName:#"to" stringValue:[NSString stringWithFormat:#"%##%#/%#", #"newone", GroupChatRoomName,myJID]];
NSXMLElement *xelement = [NSXMLElement elementWithName:#"x" xmlns:XMPPMUCNamespace];
[presence addChild:xelement];
[appDelegate.xmppStream sendElement:presence];
}
}
May this help you.
You have to join all your previous join/connected groups. Because in iOS if you kill your app then you left from your created or joined groups.
So every time in this section of the code
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
you have to join your group again.
Below is demo code for it :
XMPPRoomHybridStorage *xmppRoomStorage1 = [XMPPRoomHybridStorage sharedInstance];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:xmppRoomStorage1 jid:RoomName];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom activate:appDelegate.Obj_xmppManager.xmppStream];
NSXMLElement *history = [NSXMLElement elementWithName:#"history"];
[history addAttributeWithName:#"maxstanzas" stringValue:#"1"];
[xmppRoom joinRoomUsingNickname:self.xmppStream.myJID.user history:nil];
Adding to the Presence answer, I would also check more basic things -
Are the rooms (group chat) you create persistant?
or do you have to create the room again every time you connect?
(notice the difference between 'openning' and 'creating').
On some servers, rooms are temporary by default - you can check this by connecting with 2 seperate clients, send some messages, disconnect only one of them, and reconnect - if you do see the messages that were sent in your reconnected client - this might be your issue, can you show the parameters you pass to the server when you create the room?.
Is the server you are using configured to send history messages by default, and if so how many, again, server implementations may vary, could you share some information on the server you are using (openfire, ejabbered, prosody)? or a snippet from you configuration file?
Is it possible you are getting the messages, but not showing them correctly, maybe not refreshing the screen\view when first entering a room? any log messages?
I am also facing this issue since a week and looking for solution and after a lot of search on google and stack overflow i got a clue which solve this issue.
In my case group created successfully and chat is working good with members and members can send me chat too but when any member of group logout or kill the app and then login again he is unable to send message is this group and group says in response Only occupants are allowed to send messages to the conference.
In my case when user tap on group to go into group and start chat i call this method to join group.
NSString *roomJID = [NSString stringWithFormat:#"%##conference.yourHostName", roomJid];
XMPPJID *jid = [XMPPJID jidWithString:roomJID];
_xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:xmppRoomCoreDataStorage jid:jid dispatchQueue:dispatch_get_main_queue()];
[_xmppRoom activate:stream];
[_xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[_xmppRoom joinRoomUsingNickname:stream.myJID.bare history:nil];
Hope this will work for you too
By default a MUCRoom will send some history to newly joined user, the number is determined by config, under mod_muc: history_size:.
Or you need to explicitly request for some amount of history while sending the Presence, doc:
<presence
from='hag66#shakespeare.lit/pda'
id='n13mt3l'
to='coven#chat.shakespeare.lit/thirdwitch'>
<x xmlns='http://jabber.org/protocol/muc'>
<history maxstanzas='20'/>
</x>
</presence>

How to create a new group for chat using xmppframework?

Hi I'm developing a chat application in IOS and completed one to one chat, after searching a lot about groupChat, unable to got how to create a normal group in xmppframework.
What I already tried here is a link
iOS XMPP group chat implementation
Accepting chatroom invitation
How to create MultiUserChatRoom using XMPPFramework in iPhone
XMPPFramework - How to Create a MultiUserChat Rooms?
But didnt get any positive response from these above links,
In coding I tried
XMPPRoomCoreDataStorage *rosterstorage = [[XMPPRoomCoreDataStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:rosterstorage jid:[XMPPJID jidWithString:#"test#conference.domainName.com/rohit"] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom configureRoomUsingOptions:nil];
[xmppRoom activate:[self xmppStream]];
[xmppRoom addDelegate:self
delegateQueue:dispatch_get_main_queue()];
[xmppRoom inviteUser:[XMPPJID jidWithString:#"abc#domainName.com"] withMessage:#"Hi join room"];
Also this
- (void)createOrEnterRoom:(NSString *)roomName
{
//here we enter a room, or if the room does not yet exist, this method creates it
//per XMPP documentation: "If the room does not yet exist, the service SHOULD create the room"
//this method accepts an argument which is what you would baptize the room you wish created
XMPPPresence *presence = [XMPPPresence presence];
NSString *room = [roomName stringByAppendingString:#"#conference.domain.com"];
[presence addAttributeWithName:#"to" stringValue:room];
NSXMLElement *x = [NSXMLElement elementWithName:#"x" xmlns:#"http://jabber.org/protocol/muc"];
NSXMLElement *history = [NSXMLElement elementWithName:#"history"];
[history addAttributeWithName:#"maxstanzas" stringValue:#"50"];
[x addChild:history];
[presence addChild:x];
[[self xmppStream] sendElement:presence];
}
Last one is
-(void)createGroup
{
#try {
NSString *username=#"user_3";//[self.userDefault valueForKey:#"userid"];
NSXMLElement *presenceElement=[NSXMLElement elementWithName:#"presence"];
[presenceElement addAttributeWithName:#"type" stringValue:#"groupchat"];
[presenceElement addAttributeWithName:#"from" stringValue:[NSString stringWithFormat:#"%#%#",username,HostName]];
[presenceElement addAttributeWithName:#"to" stringValue:[NSString stringWithFormat:#"testGroup#conference.%#/%#",HostName,username]];
NSXMLElement *xElement=[NSXMLElement elementWithName:#"x" xmlns:#"http://jabber.org/protocol/muc"];
NSXMLElement *historyElement=[NSXMLElement elementWithName:#"history"];
[xElement addChild:historyElement];
[presenceElement addChild:xElement];
[self.xmppStream sendElement:presenceElement];
}
#catch (NSException *exception) {
}
}
Anyone please show me a way to solve out this. Please also let me know if we need to configure something extra in ejjabered configuration.
Please find go through this i found best and detailed answer here .
Trouble creating xmpp muc room: Code 503 (service unavailable)
Infact group chat is not provided by XMPP, its a chat room that you have created with XMPPRoom,
or you can say conversation.
You cant send offline group messages with this.
I have implement Group chat in my http://www.catchbuddies.com/ project with the help of other custom server.
You can make and configue group chat with the help of some webservces for Groups.
You should check your muc settings of ejabberd server configuration.
make sure muc host is set correctly.
in my case, I changed host to {host, "pub.#HOST#"}, then I tried to join room "test#conference.#HOST#" always got service unavailable error, it took me a whole night to fix.
also, you can use imessage login to your jabber server with admin user, and create chat room before you run ios client.
Change ejabberd log level to debug may help a lot.
For group creation change setting for muc_room. Also prefer this url will suggest the way for setting https://serverfault.com/questions/185770/configuring-ejabberd-for-multi-user-chat

Accepting chatroom invitation

I'm able to create a MUC using XMPPFramework and send user invitation requests to join that room by using the code below.
// Creating
AppDelegate *dele =(AppDelegate *) [[UIApplication sharedApplication]delegate];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:dele jid:[XMPPJID jidWithString:self.roomName] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom addDelegate:dele delegateQueue:dispatch_get_main_queue()];
[xmppRoom activate:dele.xmppStream];
[xmppRoom joinRoomUsingNickname:self.myNick history:nil];
// Inviting
[xmppRoom inviteUser:[XMPPJID jidWithString:#"abc#host"] withMessage:#"Come Join me"];
How does a user "abc" know that he has received an invitation and how can he react to it either by accepting or declining?
I could not find any class in XMPPFramework which directly deal with chat room invitation.
My research says that whenever a user receives an chatroom invitation, xmmppStream's delegate method is called:
- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message
In that message, I check whether the it contains NSXMLElement with name "invite", and if it contains then i send a callback to the user. Then i create chatroom with the same name as the name of the chatroom from which user received invitation and enter that newly created room. It works fine but quiet lengthy and not quiet efficient.
I want to know if there is a class in XMPPFramework available here which could handle chat room invitation separately. For instance, detecting, accepting, and declining of room invitations.
My code for extracting room name:
- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message
{
NSXMLElement * x = [message elementForName:#"x" xmlns:XMPPMUCUserNamespace];
NSXMLElement * invite = [x elementForName:#"invite"];
NSXMLElement * decline = [x elementForName:#"decline"];
NSXMLElement * directInvite = [message elementForName:#"x" xmlns:#"jabber:x:conference"];
NSString *msg = [[message elementForName:#"body"]stringValue];
NSString *from = [[[message attributeForName:#"from"]stringValue];
if (invite || directInvite)
{
[self createAndEnterRoom:from Message:msg];
return;
}
[self.delegate newMessageRecieved:msg];
}
For room invitations and declines, implement XMPPMUCDelegate and its methods -xmppMUC:didReceiveRoomInvitation: and -xmppMUC:didReceiveRoomInvitationDecline:.
To get the room JID, invoke [message from];
To join the room, instantiate an XMPPRoom and invoke -joinRoomUsingNickname:history:.
Then have your room delegate class implement XMPPRoomDelegate, and implement some of the delegate methods to handle receiving messages in the room.
It looks like there isn't at present a more automatic way to respond to invitations.
Update: The delegate callbacks now receive the room JID as a parameter, clarifying the semantics a bit.
- (void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *) roomJID didReceiveInvitation:(XMPPMessage *)message;
- (void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *) roomJID didReceiveInvitationDecline:(XMPPMessage *)message;
just add below code
if ([presenceType isEqualToString:#"subscribe"]) {
[_chatDelegate newBuddyOnline:[NSString stringWithFormat:#"%##%#", presenceFromUser, #"localhost"]];
NSLog(#"presence user wants to subscribe %#",presenceFromUser);
[xmppRoster acceptPresenceSubscriptionRequestFrom:[presence from] andAddToRoster:YES];
//For reject button
// [xmppRoster rejectPresenceSubscriptionRequestFrom:[tmpPresence from]];
}
inside the method
- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence ;
method

MUC How-to with XMPPFramework

I am developing an iOS XMPP chat app that utilizes Robbie Hanson's XMPPFramework.
The most important functionalities have been implemented - sending and receiving messages. Basically, I've built a basic functional chat app already, with a little eye candy of course.
Now, the problem I have is regarding MUC. The codes I saw from other websites show that there is a method initWithRoomName in XMPPRoom. However, this method is absent in the git repo I cloned. So, what is the alternative to this? Or, if there is none, how do I go about creating rooms using XMPPFramework?
Thanks.
Below is how I got my own problem solved. Note that this solution does not involve XMPPRoom at all. First, I created a method that, depending on the situation, either creates or enters a room. (Per XMPP documentation, the XML request for creating is the same is the same as the one you would send to enter a room; that is, if the room has does not exist yet when you enter it, the service will create it for you.)
Here we go. This is the method that creates/enters a room. What this method does is send a presence to the room which you intend to create/enter. If you are the first to enter a room and the room has not been created yet, you automatically become its owner and moderator.
- (void)createOrEnterRoom:(NSString *)roomName
{
//here we enter a room, or if the room does not yet exist, this method creates it
//per XMPP documentation: "If the room does not yet exist, the service SHOULD create the room"
//this method accepts an argument which is what you would baptize the room you wish created
NSXMLElement *presence = [NSXMLElement elementWithName:#"presence"];
NSString *room = [roomName stringByAppendingString:#"#conference.jabber.com/iMac"];
[presence addAttributeWithName:#"to" stringValue:room];
NSXMLElement *x = [NSXMLElement elementWithName:#"x" xmlns:#"http://jabber.org/protocol/muc"];
NSXMLElement *history = [NSXMLElement elementWithName:#"history"];
[history addAttributeWithName:#"maxstanzas" stringValue:#"50"];
[x addChild:history];
[presence addChild:x];
[[self xmppStream] sendElement:presence];
}
Next, in the AppDelegate where XMPPStream methods are declared we filter the XML response we receive in the didReceivePresence method by checking the status code sent by the server. If the status code is 201, bingo! The room creation went just fine. Status codes other than 201 mean different things, but let's focus on 201 for our purpose.
- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
{
NSXMLElement *x = [presence elementForName:#"x" xmlns:#"http://jabber.org/protocol/muc#user"];
for (NSXMLElement *status in [x elementsForName:#"status"])
{
switch ([status attributeIntValueForName:#"code"])
{
case 201: [self notifyRoomCreationOk:room];
}
}
}
Then, we tell the server that what we are creating a room of the type "instant," which means that we will send an IQ element telling it room defaults. notifyRoomCreationOk is a delegate method called in a different view when the room creation succeeds, after all I have to record the room in a text file to make it persistent so that the next time I open the app the room I created before will be visible. In my notifyRoomCreationOk method, I have sendDefaultRoomConfig which, basically, describes what is stated in the first sentence of this paragraph.
-(void)sendDefaultRoomConfig:(NSString *)room
{
NSXMLElement *x = [NSXMLElement elementWithName:#"x" xmlns:#"jabber:x:data"];
[x addAttributeWithName:#"type" stringValue:#"submit"];
NSXMLElement *query = [NSXMLElement elementWithName:#"query" xmlns:#"http://jabber.org/protocol/muc#owner"];
[query addChild:x];
XMPPIQ *iq = [XMPPIQ iq];
[iq addAttributeWithName:#"id" stringValue:[NSString stringWithFormat:#"inroom-cr%#", room]];
[iq addAttributeWithName:#"to" stringValue:room];
[iq addAttributeWithName:#"type" stringValue:#"set"];
[iq addChild:query];
[[self xmppStream ] sendElement:iq];
}
Make sure that you have XMPPStream enabled on the views that call the above methods, otherwise, these won't work. That's all there is to it. Have fun XMPP-ing!
XMPPRoom *room = [[XMPPRoom alloc] initWithRoomName:#"user101#conference.jabber.org/room" nickName:#"room"];
[room createOrJoinRoom];
[room sendInstantRoomConfig];
[room setInvitedUser:#"ABC#jabber.org"];
[room activate:[self xmppStream]];
[room inviteUser:jid1 withMessage:#"hello please join."];
[room sendMessage:#"HELLO"];
the user ABC#jabber.org should receive the invite message
Your post is old, however now I would do it like this:
- (void)createRoomWithJid:(XMPPJID*)roomJID
{
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:self.xmppRoomHybridStorage
jid:roomJID
dispatchQueue:dispatch_get_main_queue()];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom activate:self.xmppStream];
[xmppRoom joinRoomUsingNickname:self.xmppStream.myJID.user
history:nil
password:nil];
}
Create chat room by given below code using XMPPFRAMWORK.
let roomStorage: XMPPRoomMemoryStorage = XMPPRoomMemoryStorage()
/**
* Remember to add 'conference' in your JID like this:
* e.g. uniqueRoomJID#conference.yourserverdomain
*/
let roomJID: XMPPJID = XMPPJID.jidWithString("chatRoom_name#conference.myhostname")
let xmppRoom: XMPPRoom = XMPPRoom(roomStorage: roomStorage,
jid: roomJID,
dispatchQueue: dispatch_get_main_queue())
xmppRoom.activate(SKxmpp.manager().xmppStream)
xmppRoom.addDelegate(self, delegateQueue: dispatch_get_main_queue())
xmppRoom.joinRoomUsingNickname(SKxmpp.manager().xmppStream.myJID.user, history: nil, password: nil)
xmppRoom.fetchConfigurationForm()

Resources