6
votes

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
1
Could you provide code example presenting how have you tried to include strophe.js inside Titanium?daniula
Thanks for your response @daniula. I updated the code that i tried to register a new user.Prabhu

1 Answers

0
votes

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.