Strophe js in Titanium Appcelerator?
Asked Answered
G

1

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
Gave answered 27/5, 2014 at 9:24 Comment(2)
Could you provide code example presenting how have you tried to include strophe.js inside Titanium?Lashawna
Thanks for your response @daniula. I updated the code that i tried to register a new user.Gave
L
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.

Lashawna answered 27/5, 2014 at 10:48 Comment(5)
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 objectGave
Did you try to clone whole repository and build it example app?Lashawna
yes, i downloaded that project and imported that as an existing titanium project.Gave
Hey daniula, did you have any success on that? Thanks!Dogwood
@CarlosHenriqueLustosa NopeLashawna

© 2022 - 2024 — McMap. All rights reserved.