02-16-2015 05:22 AM
Dear all,
I am trying to use the Jabber SDK to create a multi-user chat session using MUCController and MUCRoom functions to enter a room and invite occupants within a previoulsly created room. The issue I am facing is that the 'enter' function doesn't return anything, success callback is not called, error's one neither and the roomEntered event is not triggered. My code looks as follow (assuming client is already connected and working (tested by sending of 1-to-1 messages):
var roster = new jabberwerx.RosterController(client); // Is the roster needed here?
var muc = new jabberwerx.MUCController(client);
var room = muc.room(roomJID); // "newroom@domain"
// Room listeners
room.event('roomEntered').bind(function(evt){
console.log('Room entered event');
// Listeners when room is active
room.event('roomExited').bind(function(evt){
room.destroy();
room = null;
});
room.event('roomBroadcastReceived').bind(function(evt){
var from = evt.data.getFrom();
var body = evt.data.getBody();
console.log('New message from ' + from + ' : ' + body);
});
});
// Room enter
room.enter('my_nickname', {
successCallback: function(){
console.log('Entering room successful');
},
errorCallback: function(err, aborted){
console.log('Error while entering room : ' + err);
room.destroy();
room = null;
}
});
Basically, nothing happens when room.enter is called. If I try to do room.invite after, I get something like:
Uncaught [object Object]
jabberwerx.MUCRoom.jabberwerx.Entity.extend.invite
(anonymous function)
jQuery.event.handle
jQuery.event.add.elemData.handle.eventHandle
I tried to use the multi-user chat with the client software Cisco Jabber and it works with the users I have. So it doesn't seem to be caused by server configuration or users restrictions.
Would you please have an idea of what I may be doing wrong? Thank you very much.
Kind regards,
Clément Tessier
Solved! Go to Solution.
02-16-2015 10:44 AM
Okay, I see now why it wasn't working for me, and perhaps this is the same reason it isn't working for you. First, which version of the CUPS/IM&P server are you running?
Try this if you're running 10.5: Go to Messaging->Group Chat Server Alias Mapping. Click the "Find" button. You should see a list (probably of one) of server aliases. This is what you want to use as your chat server. In other words, if it lists "conference-2-StandAloneCluster0000.yourdomain.com" then this is the code you'd use:
var room = muc.room("testroom@conference-2-StandAloneCluster0000.yourdomain.com");
I was using the wrong alias. When I changed it to the right one, my code worked again.
However, my error callback was working, and you say yours is not?
02-16-2015 10:44 AM
Okay, I see now why it wasn't working for me, and perhaps this is the same reason it isn't working for you. First, which version of the CUPS/IM&P server are you running?
Try this if you're running 10.5: Go to Messaging->Group Chat Server Alias Mapping. Click the "Find" button. You should see a list (probably of one) of server aliases. This is what you want to use as your chat server. In other words, if it lists "conference-2-StandAloneCluster0000.yourdomain.com" then this is the code you'd use:
var room = muc.room("testroom@conference-2-StandAloneCluster0000.yourdomain.com");
I was using the wrong alias. When I changed it to the right one, my code worked again.
However, my error callback was working, and you say yours is not?
02-17-2015 12:52 AM
Thank you for your quick reply Nicholas.
Actually it seems the server is running version 9.1 but it may not differ too much? My server administrator is on leave right now, do you think I could figure this alias out without having to access the server's administration panel?
Indeed when I use something like "testroom@domain", none of the callbacks are called, not even the error one. However, if I attempt to fetch config of the room after I tried entering it, I get something like:
If I try to use the same chat room alias as you describe above, I get: Error while entering room : {urn:ietf:params:xml:ns:xmpp-stanzas}item-not-found
Finally, do you think I could try to run this code using a DevNet sandbox? If yes, which one? Shared Endpoint Lab? And how would I figure what chat alias to use?
Thank you for your help.
02-17-2015 06:13 AM
I was able to get the chat server alias needed to create a chat room and things work now. I am now able to enter the room and invite people as well as broadcasting messages. I will now try to go further in my implementation but that's a huge obstacle broken through. Thank you.
I am also realising now that this alias can be retrieved by fetching through the entitySet contained in the client. Text conferencing servers should show.
client.entitySet.each(function(entity){
// Display domain of each text conferencing servers
if(entity.getDisplayName() === 'Text Conferencing') {
console.log(entity.jid.toString());
}
});
Thank you for your help.
Kind regards,
Clément Tessier
02-17-2015 07:11 AM
Thanks for that tip! Maybe you should come to work at Cisco?
02-17-2015 08:26 AM
You're welcome.
Haha, I am French so that may be a bit difficult for me to make it to Texas... and unfortunately, that's the only aspect I was able to figure out by myself
Thank you for your help anyway
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: