Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ejabberd module to accept / forward modified xml stanzas

Tags:

xml

xmpp

ejabberd

I'm relatively new to ejabberd and Erlang, so apologies if this is rather basic. I'm looking to introduce new data types / elements in the message stanza (i.e. parallel to 'body') sent from the client to server and reverse. Whilst I could implement the former rather easily in my iOS client, I'm struggling to understand how do I make ejabberd understand these updated incoming messages, and what needs to be changed further to have the server be able to forward these messages on to further clients.

Would anyone be able to broadly outline what all types of changes, etc. this would incur? Or any other starting points that can help me get educated here...? Or else if there is a ready module or code that someone could show me, that'd be helpful. Afraid haven't been able to make much traction reviewing docs, etc.

If its worth it, I've compiled ejabberd 15.04 on Ubuntu and I am using an iOS client.

Thanks!

like image 468
vikram17000 Avatar asked Nov 20 '25 05:11

vikram17000


1 Answers

XMPP is fully extensible by design. It means you can introduce new elements with custom namespace as you see fit (at the same level as body) and ejabberd will pass that unmodified to the recipient client.

You have nothing special to do on ejabberd side.

For example. an extended XMPP may look like the following (see the custom tag):

   <message
       from='[email protected]/balcony'
       id='ktx72v49'
       to='[email protected]'
       type='chat'
       xml:lang='en'>
     <body>Art thou not Romeo, and a Montague?</body>
     <custom xmlns='urn:custom:data'>Content</custom>
   </message>
like image 187
Mickaël Rémond Avatar answered Nov 21 '25 22:11

Mickaël Rémond



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!