Giter Club home page Giter Club logo

Comments (10)

jcbrand avatar jcbrand commented on May 18, 2024

Hi Brandon, why do you set prebind=true? What are you trying to do?

Did you read the relevant part in the docs?
http://conversejs.org/docs/html/index.html#pre-binding-and-single-session-support

from converse.js.

cryptomatictrader avatar cryptomatictrader commented on May 18, 2024

Hi jcbrand,

I have read the link you gave us and I'm having the same problem too. Basically what I'm trying to achieve is the single sign-on from the user's perspective, i.e. once they sign on our site, they don't have to sign on the XMPP server again. So in the Rails backend, I do the pre-bind for the user, obtain the corresponding jid, sid, and rid and pass them to the javascript.

In the javascript (main.js), I have:

require(["jquery", "converse"], function($, converse) {
    console.log(gon.jabber_id)
    console.log(gon.jabber_sid)
    console.log(gon.jabber_rid)
    converse.initialize({
        auto_list_rooms: false,
        auto_subscribe: false,
        bosh_service_url: gon.xmpp_bosh_service_url,
        hide_muc_server: false,
        i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
        prebind: true,
        show_controlbox_by_default: true,
        xhr_user_search: false
    });
    var connection = new Strophe.Connection(gon.xmpp_bosh_service_url);
    connection.attach(gon.jabber_id, gon.jabber_sid, gon.jabber_rid, function (status) {
        if ((status === Strophe.Status.ATTACHED) || (status === Strophe.Status.CONNECTED)) {
            converse.onConnected(connection)
        }
    });

});

The javascript console shows I have got the right IDs, i.e.

[email protected]
0da01f6073c514cd7fbb4dc322820e6df6219fec
7268

and then it complains "TypeError: converse.rosterview is undefined" at line 675:

this.$el.append(converse.rosterview.$el);

Is there anything we haven't done it correctly? Please kindly advise. Thank you so much!

Calvin

from converse.js.

cryptomatictrader avatar cryptomatictrader commented on May 18, 2024

I didn't include the resource name in the JID "[email protected]" and thought that was causing the problem. But even with JID having the resource name, e.g. [email protected]/laptop, I got the same error... 8-(

from converse.js.

cryptomatictrader avatar cryptomatictrader commented on May 18, 2024

I spent days in this issue but still can't make it work- actually I'm not sure if this is the issue from conversejs. It could possibly the issue from strophejs. For now I have to work around it (with code changes) by passing the user's jid and password to conversejs and if it exists, it will automatically login. This works for me because my application is single page application and doesn't have multiple page flow.

from converse.js.

 avatar commented on May 18, 2024

Had the same issue. Fixed it by show_controlbox_by_default: false inside converse.initialize({}). Now there are no any errors in console.

My JS code:

require(["jquery", "converse"], function($, converse) {
    converse.initialize({
        auto_list_rooms: false,
        auto_subscribe: false,
        bosh_service_url: '',
        hide_muc_server: true,
        i18n: locales.en,
        prebind: true,
        show_controlbox_by_default: false, /*prebind:true + show_control_...:true = errors*/
        xhr_user_search: false,
        fullname: '{{.user.Fullname}}'
    });
    $.getJSON('/prebind', function (data) {
        var connection = new Strophe.Connection(data.BoshServer);
        connection.attach(data.JID, data.SID, data.RID, function (status) {
            if ((status === Strophe.Status.ATTACHED) || (status === Strophe.Status.CONNECTED))
                converse.onConnected(connection)
        });
    });
});

from converse.js.

vdurbha avatar vdurbha commented on May 18, 2024

I'm also facing the exact same error when I set prebind=true.

from converse.js.

jcbrand avatar jcbrand commented on May 18, 2024

Hi @calvinchso and @vdurbha, sorry this thread seems to have passed my by!

Can you please check whether any of these errors still occur in the newest release?
https://github.com/jcbrand/converse.js/releases/tag/v0.5.1

from converse.js.

cryptomatictrader avatar cryptomatictrader commented on May 18, 2024

Hi jcbrand,

Sorry I no longer have the code base to try that out. Hopefully others in this thread can share the results. Thanks for the reply anyway!

from converse.js.

bhargavpandya avatar bhargavpandya commented on May 18, 2024

Can anyone give me the example of the HTML file which can pass the username and password to the converse.js and it will automatically login.. This is really urgent..

Regards
bhargav L Pandya

from converse.js.

wex avatar wex commented on May 18, 2024

Just for notice (at least in newest version). Just spent some time to fix same error message on 0.7.4 and also have prebind = true.

If prebind is set true, also jid, sid, rid and bosh_service_url MUST be set in configuration parameters.

Otherwise converse.onConnected() wont be called. converse.onConnected() initialize quite a lot of things (like roster).

from converse.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.