Reputation: 4266
I have setup openfire server and I am able to connect converse.js client. It is working fine.
I however do not want to use the converse.js UI. Is there a way to only use converse api without the Backbone UI part.
I tried removing the Backbone part but it is not working.
I understand it uses strophe internally but converse have readymade functions
Upvotes: 2
Views: 914
Reputation: 2692
Firstly, it should possible to use Converse simply as an engine, or API and I've done some work to make this usecase feasible. Specifically by splitting Converse out into plugins. However, I haven't used it myself like that yet, so it's rather theoretical still at this point.
Backbone is however is critical, because it's used for more than just Views. Backbone Models and Collections are used to model data and relationships between objects. So you can't remove it.
As mentioned, Converse is made up of plugins. The plugins that are included in the final build (created by running make dist
) are all listed in src/converse.js.
You can create customized builds by editing this file and removing plugins that you don't want.
So for example the converse-chatview.js
plugin contains Backbone Views for rendering chat boxes. So it can be removed. Similarly the converse-controlbox.js
is a View that renders the control box can also be removed.
Other plugins to remove would be converse-minimize.js
and converse-dragresize.js
, both which are UI-focused.
However, here comes the fly in the ointment. converse-muc.js
, which provides support for groupchats contains boths views and models, and is not yet split up. So if you need to support groupchats, then you'll need to include that plugin and its views in turn depend on converse-chatview.js
, so it will also be included (even if you remove it from converse-config.js
).
What needs to happen is that converse-muc.js
needs to be split into two files, converse-muc.js
and converse-muc-views.js
(this will probably happen in a future release). Then you could remove the latter from your build.
So, sorry if this is not a super satisfying answer.
What you can also do is write your own plugins, and in those plugins you can override or change any of the Models, Collections or Views from other plugins (if your plugin depends on them, and is therefore loaded after them). This however requires you to study the code somewhat, to develop a decent understanding of what needs to be done.
EDIT: For more info on the plugins and how they work, take a look at pluggable.js which is the underlying library and the relevant converse.js documentation.
Upvotes: 2