EzDevInfo.com

converse.js

Web-based XMPP/Jabber chat client written in javascript Converse.js converse.js: a free chat client for your website

conversejs : The number of chat windows that can open is based on what can fit based on the screens width

Is there a way in ConverseJS to set the MAXIMUM number of CHAT windows that can be opened ? Or do I need to handle it the CSS way ? Also, what is the Best ConverseJS EVENT where I can STOP the Chat window from being opened ?


Source: (StackOverflow)

Create password protected room using converse.js plugin [closed]

I am trying to create password protected room.

I can create public room and configure password from configuration tab. But initially I have to create room as unsecured and public.

I want to create room with password protected, so I don't need to go to config tab to set password.

Is that possible to create room with password using just one call or one stanza. Right now I can do that with two manual operations of creating and configuring the room.

If anyone can provide stanza, that would be great help. I would like to know if this is possible or not.


Source: (StackOverflow)

Advertisements

How to configure BOSH server to support my own XMPP server?

I set up a BOSH server using node-xmpp-bosh and configured converse.js (a javascript XMPP client) to use the BOSH url I set up, I tried log in with my jabber.org account on converse.js and all worked fine.

Now I need to make this work with a private XMPP server. Assume that the XMPP server is at chat.mysite.com:5222, a JID on the server is johndoe@mysite.com. How do I configure the BOSH server so that it connects to chat.mysite.com:5222 when I try to log in with johndoe@mysite.com on converse.js?


Source: (StackOverflow)

Disconnection issue with converse prebind by smash to openfire

I'm using Openfire to make an http-binding with Converse.js. I want to prebind it in order to make single session on my webapp. I used the java librarie smack-bosh.

I succeed to login (and stay logged) with converse directly to openfire (chat, add contact, join room, ...) I also succeed login smack to openfire and stay logged. I succesffuly retrieve Jid, Sid, Rid to prebind. I prebind and login with converse.js but i got disconnect because of overactivity. I set xmpp.httpbind.client.requests.ignoreOveractivity to true in OpenFire as mentioned here. Over activity is know fixed.

I stay logged if i do nothing. But as soon I try to send message or add contact or change status, OpenFire disconnect the session. In OpenFire logs, if I well understand, it's because the session is apparently "unavailable" but in reality converse is still connected because try to make a request and receive a "Invalid SID" Error.

OpenFire logs :

2014.08.22 17:26:05 org.jivesoftware.openfire.http.HttpSession - consumeResponse: org.jivesoftware.openfire.http.HttpSession@e8ecbb status: 3 address: test@127.0.0.1/fdf7cf75 id: fdf7cf75 presence:
<presence id="3bP9K-37" from="test@127.0.0.1/fdf7cf75" to="test@127.0.0.1/fdf7cf75"/> rid: 891999928666552
2014.08.22 17:26:05 org.jivesoftware.openfire.http.HttpSession - consumeResponse: org.jivesoftware.openfire.http.HttpSession@e8ecbb status: 3 address: test@127.0.0.1/fdf7cf75 id: fdf7cf75 presence:
<presence from="test@127.0.0.1/fdf7cf75">
<show>dnd</show>
</presence> rid: 891999928666553
2014.08.22 17:26:05 org.jivesoftware.openfire.http.HttpSession - consumeResponse: org.jivesoftware.openfire.http.HttpSession@e8ecbb status: 3 address: test@127.0.0.1/fdf7cf75 id: fdf7cf75 presence:
<presence from="test@127.0.0.1/fdf7cf75">
<show>dnd</show>
</presence> rid: 891999928666554
2014.08.22 17:26:09 org.jivesoftware.openfire.http.HttpSession - consumeResponse: org.jivesoftware.openfire.http.HttpSession@e8ecbb status: -1 address: test@127.0.0.1/fdf7cf75 id: fdf7cf75 presence:
<presence type="unavailable" from="test@127.0.0.1/fdf7cf75"/> rid: 891999928666554 

converse logs :

0 request id 3.0 posting converse.min.js:223
0 request id 3.0 state changed to 1 converse.min.js:223
<body rid=​"891999928666554" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"fdf7cf75">​    </body>​ converse.min.js:223
0 request id 3.1 state changed to 2 converse.min.js:223
0 request id 3.1 state changed to 3 converse.min.js:223
0 request id 3.1 state changed to 4 converse.min.js:223
0 removing request converse.min.js:223
0 _throttledRequestHandler called with 0 requests converse.min.js:223
0 request id 3 should now be removed converse.min.js:223
0 request id 3.1 got 200 converse.min.js:223
1 _dataRecv called converse.min.js:223
<body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​</body>​ converse.min.js:223
1 no requests during idle cycle, sending blank request converse.min.js:223
0 request id 4.0 posting converse.min.js:223
0 request id 4.0 state changed to 1 converse.min.js:223
<body rid=​"891999928666555" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"fdf7cf75">​</body>​ converse.min.js:223
POST http://127.0.0.1:7070/http-bind/ 404 (Invalid SID.) converse.min.js:223
  l converse.min.js:223
  Strophe.Bosh._processRequest converse.min.js:223
  Strophe.Bosh._throttledRequestHandler converse.min.js:223
  Strophe.Bosh._sendTerminate converse.min.js:223
  Strophe.Bosh._disconnect converse.min.js:223
  t.Connection.disconnect converse.min.js:223
  t.Connection._dataRecv converse.min.js:223
  Strophe.Bosh._onRequestStateChange
0 request id 4.1 state changed to 2 converse.min.js:223
0 request id 4.1 state changed to 3 converse.min.js:223
0 request id 4.1 state changed to 4 converse.min.js:223
0 removing request converse.min.js:223
0 _throttledRequestHandler called with 0 requests converse.min.js:223
0 request id 4 should now be removed converse.min.js:223
ERROR: request id 4.1 error 404 happened converse.min.js:223
2 request errored, status: 404, number of errors: 1 converse.min.js:223
1 _doDisconnect was called

Stanza logs :

<jive xmlns="http://www.jivesoftware.org">
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="connected" timestamp="août 22, 2014 06:05:26:873 PM"><iq xmlns="" id="3bP9K-42" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource/></bind></iq></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:26:876 PM"><iq xmlns="" type="result" id="3bP9K-42" to="127.0.0.1/ec1f570e"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>test@127.0.0.1/ec1f570e</jid></bind></iq></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:26:881 PM"><iq xmlns="" id="3bP9K-43" type="set" from="test@127.0.0.1/ec1f570e"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:26:881 PM"><iq xmlns="" type="result" id="3bP9K-43" to="test@127.0.0.1/ec1f570e"/></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:26:892 PM"><iq xmlns="" id="3bP9K-44" type="get" from="test@127.0.0.1/ec1f570e"><query xmlns="jabber:iq:roster"/></iq></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:26:913 PM"><iq xmlns="" type="result" id="3bP9K-44" to="test@127.0.0.1/ec1f570e"><query xmlns="jabber:iq:roster"/></iq></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:26:914 PM"><presence xmlns="" id="3bP9K-45" from="test@127.0.0.1/ec1f570e"/></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:26:915 PM"><presence xmlns="" id="3bP9K-45" from="test@127.0.0.1/ec1f570e" to="test@127.0.0.1/ec1f570e"/></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:27:078 PM"><iq xmlns="" type="get" id="1:roster" from="test@127.0.0.1/ec1f570e"><query xmlns="jabber:iq:roster"/></iq></packet>
<packet xmlns="http://www.jivesoftware.org" streamID="ec1f570e" status="auth" timestamp="août 22, 2014 06:05:27:078 PM"><iq xmlns="" type="result" id="1:roster" to="test@127.0.0.1/ec1f570e"><query xmlns="jabber:iq:roster"/></iq></packet>

Thanks for help.


Source: (StackOverflow)

Is conversejs scalable to support 1M users

I wanted to set up a chat application for my website, so I decided to use Ratchet first. But I couldn't find the way to use it for private chat.

Now I am headed to converse.js, but before this I wanted to know that is it scalable enough to hold a growing userbase of 0 to 1M? Or is there any open source alternative that can do so easily?


Source: (StackOverflow)

ConverseJS and OpenFire

I'm trying to connect converesejs example to an openfire server which is istalled on my localhost, but the connection can not be estableshed (I don't know why). However I can connect to openfire server with Psi. I think that the problem is with http-bind...

In conversejs example there is such code that should be editied by me.

<script>
require(['converse'], function (converse) {
    converse.initialize({
        allow_otr: true,
        auto_list_rooms: false,
        auto_subscribe: false,
        bosh_service_url: 'http://localhost:7070/http-bind', // my connection manager of an openfire 
        debug: true ,
        hide_muc_server: false,
        i18n: locales['en'], // Refer to ./locale/locales.js to see which locales are supported
        prebind: false,
        show_controlbox_by_default: true,
        xhr_user_search: false,
    });
});</script>

I found some information that Apache config (httpd.conf) must be edited. So I uncommented proxy_module and proxy_http_module.

And I set up such params in httpd.conf:

ProxyRequests Off
ProxyPass /http-bind http://127.0.0.1:7070/http-bind/
ProxyPassReverse /http-bind http://127.0.0.1:7070/http-bind/

But this did't help. When I'm trying to login to the server using conversejs example page it stays in status "Connecting"...

Thanks for your help!


Source: (StackOverflow)

Java - trying to prebind converse.js using bosh but not able to get the sid and rid...using the smack bosh

I am trying to connect to the open fire using the smack bosh and trying to prebind the converse.js in the web page. My bosh code

BOSHConfiguration config = new BOSHConfiguration(false, "host", 7070, "/http-bind/", "<host>", "xmpp:127.0.0.1:5222");
BOSHConnection connection = new BOSHConnection(config);
try {
connection.connect();
connection.login("un", "pw");
String sss = connection.getConnectionID();
String bosh = connection.BOSH_URI;
} catch (Exception e) {
}

Can some one help me how to establish a bosh connection and get the required sid, rid and jid from the session....

Any help is much appreciated.


Source: (StackOverflow)

Creating persistent connection between Converse JS and Openfire Server

Using

For now, Openfire and website has separate databases but they are synchronized.

What I want to achieve is:

when user signs in to website, Converse JS also must login and create persistent connection with Openfire XMPP Server during whole user session untlil logs out.

What I've found

Googled a lot and researched on both Converse JS and Openfire websites.

Read that, there is prebind property and Single Session Support for Converse JS which allows to achieve what I want. They also, provide PHP library example for website.

What I've done

Initial script for Converse JS looks like that:

converse.initialize({
    bosh_service_url: 'https://bind.example.com',
    keepalive: true,
    jid: 'me@example.com',
    authentication: 'prebind',
    prebind_url: 'http://example.com/api/prebind',
    allow_logout: false
});

As far as I understand whole process goes like below:

enter image description here

  1. sends jid to prebind_url which is http://example.com/api/prebind (take a look at configuration properties above)
  2. PHP backend receives jid (which is username). To authenticate in XMPP server password, login must be in plain text format. Converse JS, as far as I know, to keep user logged in messenger, may send request to http://example.com/api/prebind pretty much everytime when it needs (jid, sid, rid). So, from PHP side plain text authentication is required to be ready everytime.
  3. PHP backend gets results from XMPP Server (jid, sid, rid) using PHP library
  4. Returns back jid, sid, rid as JSON

So question is

Confusion starts in 2nd step: should I save user's XMPP password and login in plain text format in PHP sessions because of XMPP authentication? Or am I getting it wrong and there is more secure way to achieve it?

And in 3rd step, while testing with working username and password getting Invalid challenge response received error. Is there any working library for authenticating from PHP?


Source: (StackOverflow)

Trying Prebinding converse.js with php to an openfire server

So I have a web site where you can login with a username and a password and I would like that with that one login, a session could be generated for converse.js

I've been reading the documentation and the SSO Support and I ended in an example repo for prebinding with php. link

I prepared an object wich should be the model I'll call from my controller, but there are some parameters I'm not sure what they are.

$xmppPrebind = new XmppPrebind('your-jabber-host.tld', 'http://your-jabber-host/http-bind/', 'Your XMPP Clients resource name', false, false);
$xmppPrebind->connect($username, $password);
$xmppPrebind->auth();
$sessionInfo = $xmppPrebind->getSessionInfo(); // array containing sid, rid and jid

The 3rd parameter on the XmppPrebind Constructor 'Your XMPP clients resource name' what is that?

Also when doing the connect function the parameters $username and $password...are those the one I get from my loging form (the one on my website) or some valid user & password pair on the openfire server?


Source: (StackOverflow)

ConverseJS and Openfire: room joining problems

I've managed to get a converse.js v.0.9.0 client working with an openfire server I have on a Debian machine.

The connection works just fine, I've created a couple of users to test things out and everything was working fine, I could login, make private conversations between users even create rooms, which were listed properly when clicking the "list rooms" button.

The problem came when a user wanted to join a room another user created. When doing so, the window with the room name popped properly but the users list in that room was empty and communication didn't exist at all (no one could see each others messages on that room).

I took a look on the openfire admin panel and in the conference server the room was properly displayed but only with 1 user in it.

Is this a problem with the openfire conference server configuration? or is it the converse client that needs an extra module for room chats?

I'l put the code of the test page to see if it can help.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>prueba</title>
    <link rel="stylesheet" type="text/css" media="screen" rel='nofollow' href="css/converse.css">
    <script src="builds/converse.js"></script>
</head>
<body>

</body>
<script>
    require(['converse'], function (converse) {
 converse.initialize({
 auto_list_rooms: false,
 auto_subscribe: false,
 bosh_service_url: 'http://converse:7070/http-bind/', 
 hide_muc_server: false,
 i18n: locales.en, 
 prebind: false,
 show_controlbox_by_default: true,
 roster_groups: true
 });
});
</script>
</html>

Source: (StackOverflow)

XMPP and ConverseJS : Recieve ALL Offline messages when user logs in

I am new to using Converse and XMPP and I am creating a CHAT application using ConverseJS as Client and Ejabberd as my XMPP Provider. I want to be able to display users with ALL the OFFLINE messages recieved from any user, when the user logs into the chat application. Any help around this can be great help.

Thanks !

Best Regards, Gauri Padbidri


Source: (StackOverflow)

How to connect converse.js with openfire?

I have installed openfire as xmmp converse.js as server and chat client and OS Windows 8.I Probe openfire with pidgin and works. I can not connect converse.js with openfire, and I have done the following: -I have enabled HTTP binding in openfire

-I modify the index of converse.js by:

require(['converse'], function (converse) {
 converse.initialize({
 auto_list_rooms: false,
 auto_subscribe: false,
 bosh_service_url: 'http://localhost:7070/http-bind/',
 hide_muc_server: false,
 i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
 prebind: false,
 show_controlbox_by_default: true,
 roster_groups: true
 });
  });

-I went to the firewall and enable the ports necessary for the connection (5222, 5229, 7070 and 7443)

-I insert in openfire the xmpp.httpbind.worker.threads and xmpp.client.processing.threads properties with value 16

-I modify apache httpd.conf: I enable LoadModule proxy_http_module and LoadModule proxy_module and I added:

ProxyRequests Off

ProxyPass / http-bind http://127.0.0.1:7070/http-bind/

ProxyPassReverse / http-bind http://127.0.0.1:7070/http-bind/

When I log in with a openfire's user the window stays on connecting.

Please if anyone has a guide on how to connect with openfire converse.js me would be helpful.

Thanks and sorry for my English


Source: (StackOverflow)

how to implement Converse.js An XMPP chat client for asp.net 4.0 web site

i just found one nice article about online chatting application with converse.js i read it's documentation and i like it. how ever i just have doubt it is there this chat facility can supported with asp.net 4.0 web site. Here i just want to know about in details is it supported with .net application.

here it's tells XMPP Chat server. Is there any additional cost for purchase it. After that how i setup this server for chat facility. here it's gives advice for identity i have to manually register user with it and i can use with my own web site.

Is there any one have idea how i implement this to my web site. Step By Step

Please help me..


Source: (StackOverflow)

Cannot install converseJS properly in Laravel 5

I am working on an application where I am trying to get the chat feature working by using the ConverseJS XMPP client on the front end and Openfire RTC on the back end.

I am working with Laravel 5 on the back end, and being the naive developer I am, I placed the files in the public folder and linked the JS and CSS file to the webpage.

<link rel="stylesheet" type="text/css" media="screen" rel='nofollow' href="/converse/css/converse.min.css">
<script src="/converse/builds/converse.min.js"></script>

It is working in Firefox and I can see the chat pluigin but in Chrome. The error I see in the console is:

Uncaught Error: See almond README: incorrect module build, no module name

I am not sure what is causing this. Placing the files in the public folder and linking it to the pages, is this the right way? Or do I have to do something extra in Laravel 5 to get it running?


Source: (StackOverflow)

How to access a nested function from another nested function in javascript

I have a javascript library which i am using as a client side chat application.My problem in this is that i am trying to access one nested function from another nested function and i know this might not be possible but there is another nested function already doing this but i cant figure out how.For example:

function a(){
       funtion displaysomething(text){
       alert (text);
       }
 }

function b(){
       function b1(){
       displaysomething ("hello");
       }
}

function c(){
       function c1(){
       displaysomething("hi");
       }
}

In the above code when i call displaysomething from function c and it works whereas when i do from function b it gives me an error.this is the actual code i am working on

converse.initialize = function (settings, callback) {
    var converse = this;

//this would be function a
this.ChatBox = Backbone.Model.extend({
        initialize: function () {
            var height = converse.applyHeightResistance(this.get('height'));
            if (this.get('box_id') !== 'controlbox') {
                this.messages = new converse.Messages();
                this.messages.browserStorage = new Backbone.BrowserStorage[converse.storage](
                    b64_sha1('converse.messages'+this.get('jid')+converse.bare_jid));
                this.save({
                    'box_id' : b64_sha1(this.get('jid')),
                    'height': height,
                    'minimized': this.get('minimized') || false,
                    'otr_status': this.get('otr_status') || UNENCRYPTED,
                    'time_minimized': this.get('time_minimized') || moment(),
                    'time_opened': this.get('time_opened') || moment().valueOf(),
                    'user_id' : Strophe.getNodeFromJid(this.get('jid')),
                    'num_unread': this.get('num_unread') || 0,
                    'url': ''
                });
            } else {
                this.set({
                    'height': height,
                    'time_opened': moment(0).valueOf(),
                    'num_unread': this.get('num_unread') || 0
                });
            }
        },


displaysomething: function (text) {

            alert(text);                

        }
    });

//this would be function b
this.ChatBoxView = Backbone.View.extend({
        model: converse.ChatBox,
        length: 200,
        tagName: 'div',
        className: 'chatbox',
        is_chatroom: false,  // This is not a multi-user chatroom

sendMessageStanza: function (text) {            

            alert("2"); 

            chatbox.displaysomething("hello"); //this is where i need it to be called

            alert("3");     //just to know if displaysomething is getting called
    });    


//this would be function c
this.ChatBoxes = Backbone.Collection.extend({
        model: converse.ChatBox,
        comparator: 'time_opened',
        onMessage: function (message) {



            var $message = $(message);
            var contact_jid, $forwarded, $received, $sent,
                msgid = $message.attr('id'),
                chatbox, resource, roster_item,
                message_from = $message.attr('from');
            if (message_from === converse.connection.jid) {
                // FIXME: Forwarded messages should be sent to specific resources,
                // not broadcasted
                return true;
            }
            $forwarded = $message.children('forwarded');
            $received = $message.children('received[xmlns="urn:xmpp:carbons:2"]');
            $sent = $message.children('sent[xmlns="urn:xmpp:carbons:2"]');

            if ($forwarded.length) {
                $message = $forwarded.children('message');
            } else if ($received.length) {
                $message = $received.children('forwarded').children('message');
                message_from = $message.attr('from');
            } else if ($sent.length) {
                $message = $sent.children('forwarded').children('message');
                message_from = $message.attr('from');
            }

            var from = Strophe.getBareJidFromJid(message_from),
                to = Strophe.getBareJidFromJid($message.attr('to'));
            if (from == converse.bare_jid) {
                // I am the sender, so this must be a forwarded message...
                contact_jid = to;
                resource = Strophe.getResourceFromJid($message.attr('to'));
            } else {
                contact_jid = from; // XXX: Should we add toLowerCase here? See ticket #234
                resource = Strophe.getResourceFromJid(message_from);
            }

            roster_item = converse.roster.get(contact_jid);
            if (roster_item === undefined) {
                // The contact was likely removed
                converse.log('Could not get roster item for JID '+contact_jid, 'error');
                return true;
            }

            chatbox = this.get(contact_jid);
            if (!chatbox) {
                var fullname = roster_item.get('fullname');
                fullname = _.isEmpty(fullname)? contact_jid: fullname;
                chatbox = this.create({
                    'id': contact_jid,
                    'jid': contact_jid,
                    'fullname': fullname,
                    'image_type': roster_item.get('image_type'),
                    'image': roster_item.get('image'),
                    'url': roster_item.get('url')
                });
            }

            if (msgid && chatbox.messages.findWhere({msgid: msgid})) {
                // FIXME: There's still a bug here..
                // If a duplicate message is received just after the chat
                // box was closed, then it'll open again (due to it being
                // created here above), with now new messages.
                // The solution is mostly likely to not let chat boxes show
                // automatically when they are created, but to require
                // "show" to be called explicitly.
                return true; // We already have this message stored.
            }
            if (!this.isOnlyChatStateNotification($message) && from !== converse.bare_jid) {
                playNotification();
            }


            chatbox.displaysomething("hello"); // this is where it is getting called

            converse.roster.addResource(contact_jid, resource);
            converse.emit('message', message);
            return true;
        }
    });

Source: (StackOverflow)