6

I want to create a chat application in Titanium appcelerator using Strophe.js library. I have gone through strophe js libraries and their documents as well. I believe we can use strophe.js to build xmpp based chat app in web.

Thanks in advance, Can anyone please clarify the following doubts,

  • Is it possible to use strophe js inside our Titanium Appcelerator,If yes please suggest me how to use it. I tried to include the strophe js inside the titanium it shows can't find module error

Here's the code i tried with.

Ti.include("includes/strophe.js");
Ti.include("includes/strophe.register.js");
connection.register.connect("localhost:5280", callback, wait, hold);
var callback = function (status) {
    if (status === Strophe.Status.REGISTER) {
        connection.register.fields.username = "newuser";
        connection.register.fields.password = "123456";
        connection.register.submit();
    } else if (status ===  Strophe.Status.REGISTERED) {
        console.log("registered!");
        connection.authenticate();
    } else if (status ===  Strophe.Status.CONNECTED) {
        console.log("logged in!");
    } else {
        // every other status a connection.connect would receive
    }
};
$.index.open();
  • Can you please suggest to use any other libraries that can be used inside the Titanium Appceleartor to build chat application using XMPP
Prabhu
  • 830
  • 10
  • 27
  • Could you provide code example presenting how have you tried to include strophe.js inside Titanium? – daniula May 27 '14 at 10:16
  • Thanks for your response @daniula. I updated the code that i tried to register a new user. – Prabhu May 27 '14 at 10:34

1 Answers1

0

Looks like Strophe is created to be used inside browser and modifying it to work inside Titanium is rather risky.

The only XMPP module for Titanium, which I could find is titanium-xmpp on GitHub.

daniula
  • 6,639
  • 4
  • 29
  • 47
  • Thanks for your clarification again @daniula. I also tried with that example that module shows an error. if you worked with that module can u please give a suggestion to clear the following error------------ [ERROR] : Script Error Couldn't find module: JXMPPJID [ERROR] : Script Error Module "xmpp/JXMPP" failed to leave a valid exports object – Prabhu May 27 '14 at 11:05
  • Did you try to clone whole repository and build it example app? – daniula May 27 '14 at 11:06
  • yes, i downloaded that project and imported that as an existing titanium project. – Prabhu May 27 '14 at 11:08
  • Hey daniula, did you have any success on that? Thanks! – Carlos Zinato Apr 20 '16 at 14:33
  • @CarlosHenriqueLustosa Nope – daniula Apr 20 '16 at 14:34