Reputation: 347
I can not find manual How join to chat room and send/receive messages ?
I use Strophe + openFire.
How I send message:
var o = {from : '[email protected]/5c5d4956', to:'[email protected]', type : 'groupchat', xmlns : Strophe.NS.MUC};
var m = $msg(o);
m.c('body', null, 'body text');
connection.send(m.tree());
How I receive:
<body xmlns='http://jabber.org/protocol/httpbind'>
<message xmlns="jabber:client" xmlns="http://jabber.org/protocol/muc" from="[email protected]" to="[email protected]/77ce8c0e" type="error"> <body>dfsdfsdfsd</body><error xmlns="" code="406" type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message></body>
Upvotes: 0
Views: 3237
Reputation: 347
Join to room :
var o = {to:'[email protected]/youNick'};
var m = $pres(o);
m.c('x', {xmlns : 'http://jabber.org/protocol/muc#user'}, null);
connection.send(m.tree());
or if need enter password
var o = {to:'[email protected]/youNick'};
var m = $pres(o);
m.c('x', {xmlns : 'http://jabber.org/protocol/muc#user'}, null).c('password', null, 'pass');
connection.send(m.tree());
Send message in room :
var o = {to:'[email protected]', type : 'groupchat'};
var m = $msg(o); m.c('body', null, 'hello');
connection.send(m.tree());
Upvotes: 4