Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

XMM plugin for PhoneGap: Strophe.js as API and ASMACK in backside

Notifications You must be signed in to change notification settings

alexstrat/PhoneGap-XMPPplugin-Android

Repository files navigation

What is that ?

That is an attempt to write an XMPP plugin for PhoneGap : it borrows the simplicity of strophe.js API and the native XMPP implementation of ASMACK.

Since the API is a shim of strophe.js one, any Strophe application or plugin should work with zero modification.

Beyond this, that was a student project for the MobServ course at EURECOM. Thus that is more a proof of concept than a complete and finished implementation. We won't continue the development but we encourage motivated people to fork !

Does it work ?

Yes, in some way ! But since this was initially developed as proof of concept, the implementation lacks some features (proper handling of connection/disconnection e.g.).

If you want to see it in action you can jump to the hangman branch which is an example of use to implement an P2P hangman game.

Note: the project's initial motivation was to bypass the XHR long-polling usage (named BOSH) made in strophe.js which is networkly inefficient and battery consuming. We thought that it will be more efficient to use a raw TCP stream (particularly in mobile environment). (We have now doubt about this.) Unfortunately we didn't have mean to test the efficiency of each solution..

How does it work ?

On the Android side, the connection with the server is handled by ASMACK. Stanzas are build on the javascript side thanks to Strophe API, then raw stanzas are passed on the native side and directly forward to the server. The reverse path follows the same schema : once received from the server, stanzas are passed raw to the javascript side where the Strophe machinery handles it as usual.

schema

Installation

In your PhoneGap Android project :

  • put XMPPPhoneGapPlugin.js and strophe.shim.js in your assets/www folder.
  • put asmack-jse.jar in lib or libs folder and build path if needed
  • put XMPPPhoneGapPlugin.java and Stanza.java in a src/eurecom/phonegap folder – or whereever you want if you modify accordingly package attribute in the code.
  • modify your res/xml/plugins.xml to add the plugin by adding the following line :
<plugin name="XMPPPhoneGapPlugin" value="eurecom.phonegap.XMPPPhoneGapPlugin"/>

API

Strophe doc

Authors

About

XMM plugin for PhoneGap: Strophe.js as API and ASMACK in backside

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages