xmppjs / xmpp.js

XMPP for JavaScript
ISC License
2.19k stars 373 forks source link

Roster Support #784

Open ShadowRanger opened 4 years ago

ShadowRanger commented 4 years ago

I can see that there have already been a couple of issues created about this, and that there was once functionality for it in this library. Are there any updates on this at all, in terms of plans of re-adding it to the library?

wichert commented 4 years ago

This is implemented in https://github.com/Crypho/xmpp-plugins . We have an open offer to move that into the xmppjs organisation.

sonnyp commented 4 years ago

@ShadowRanger it is very easy to do yourself:

const roster = await xmpp.iqCaller.get(xml('query', 'jabber:iq:roster'))
console.log(roster.getChildren('item',  'jabber:iq:roster'))

But anyway, this is on my radar (and on my hard drive :p ) but a few things need to be figured out first.

@wichert I have issues with crypho/xmpp-plugins

  1. The xml <-> javascript transformation. While it can make sense at application level (I'd avoid it if possible though), I don't think it belongs in xmpp.js.

  2. Without the transformation mentionned aboved, most plugins (including many that I wrote) don't provide enough value to justify their inclusion in xmpp.js as most features are usually just a iqCaller.get/set away. It does make the protocol slightly simpler but not enough that users wouldn't have to read/understand specifications anyway.

To address 1 I plan on writing documentation on how to use storage and state management such as redux with xmpp.js specifically with @xmpp/xml elements without the need for transforming.

To address 2 I'm considering providing storage/state management within xmpp.js (replacable and modular as the rest of xmpp.js) .

Such thing would allow providing out of the box xmpp features that requires storage. Such as roster versioning, entity capabilities, mam, ...

It could also provide offline support for other features such as messaging, pubsub, ...

As well as support stream resumption accross tab/app/process restart/reload.