librelist archives

« back to archive

cache connection

cache connection

From:
Alexandre Coloma
Date:
2014-05-13 @ 20:15
hi, i have implemented a chat with converse.js and prebind and works great,
but i have a problem if a cache connection betwen page transition, when i
attach to cached connection converse don't request for a presence users
state, how can i do this request? somebody has implemented the save option
(save state for users connected before reload page and stablish them after
reload?
thanks
Alex?

Re: [conversejs] cache connection

From:
jitu@ideas2it
Date:
2014-05-14 @ 05:45
Hi Alex,
you can do getRoster to make public in converse and call the method it will
get for you presence status...

Check onConnected method of converse.js you will get idea about how to
implement.

Otherwise you can put all roster with status in a json array of map and
make use after connected you have to put that in storage like
backbonestorage or html5 stroage or cookies(but its not good idea to store
anythink in cookies)

Refer the Link :

https://github.com/jcbrand/converse.js/issues/145#issuecomment-42429330

May be this will help you to short out your problem. :)



On Wed, May 14, 2014 at 1:45 AM, Alexandre Coloma <acoloma@beeztel.com>wrote:

> hi, i have implemented a chat with converse.js and prebind and works
> great, but i have a problem if a cache connection betwen page transition,
> when i attach to cached connection converse don't request for a presence
> users state, how can i do this request? somebody has implemented the save
> option (save state for users connected before reload page and stablish them
> after reload?
> thanks
> Alex?
>

Re: [conversejs] cache connection

From:
Alexandre Coloma
Date:
2014-05-14 @ 07:07
Hi jitum, thanks for your response, i try it this aftermoon!
Alex


2014-05-14 7:45 GMT+02:00 jitu@ideas2it <jitendara@ideas2it.com>:

> Hi Alex,
> you can do getRoster to make public in converse and call the method it
> will get for you presence status...
>
> Check onConnected method of converse.js you will get idea about how to
> implement.
>
> Otherwise you can put all roster with status in a json array of map and
> make use after connected you have to put that in storage like
> backbonestorage or html5 stroage or cookies(but its not good idea to store
> anythink in cookies)
>
> Refer the Link :
>
> https://github.com/jcbrand/converse.js/issues/145#issuecomment-42429330
>
> May be this will help you to short out your problem. :)
>
>
>
> On Wed, May 14, 2014 at 1:45 AM, Alexandre Coloma <acoloma@beeztel.com>wrote:
>
>> hi, i have implemented a chat with converse.js and prebind and works
>> great, but i have a problem if a cache connection betwen page transition,
>> when i attach to cached connection converse don't request for a presence
>> users state, how can i do this request? somebody has implemented the save
>> option (save state for users connected before reload page and stablish them
>> after reload?
>> thanks
>> Alex?
>>
>
>

Re: [conversejs] cache connection

From:
Daniel García Páez
Date:
2014-05-14 @ 07:43
Hi Alex, could you please show me the code you've implemented for the chat
with converse.js and the prebind.

I've integrated the chat in my webapp, but I don't have a clue about doing
the prebind, it's driving me crazy.

Thanks in advance.

Daniel.



>>
>>
>> On Wed, May 14, 2014 at 1:45 AM, Alexandre Coloma <acoloma@beeztel.com>wrote:
>>
>>> hi, i have implemented a chat with converse.js and prebind and works
>>> great, but i have a problem if a cache connection betwen page transition,
>>> when i attach to cached connection converse don't request for a presence
>>> users state, how can i do this request? somebody has implemented the save
>>> option (save state for users connected before reload page and stablish them
>>> after reload?
>>> thanks
>>> Alex?
>>>
>>
>>
>

Re: [conversejs] cache connection

From:
jitu@ideas2it
Date:
2014-05-14 @ 09:03
Hi Daniel,
  You can get by doing converse.getRID() and converse.getSID() so you have
right rid and sid then

you can do this one ..
first of all where you first intialize converse there you have to pass
expose_sid_and_rid
: true and then you can attah by this .....

    converse.initialize({

    prebind: true,
    bosh_service_url: data.bosh_service_url, // Here is the url of server
    jid: 'jitu@localhost',
    sid: converse.getSID(),
    rid: converse.getRID()
    });


Hope this one will help you to short out your problem



On Wed, May 14, 2014 at 1:13 PM, Daniel García Páez <
daniegarcia254@gmail.com> wrote:

> Hi Alex, could you please show me the code you've implemented for the chat
> with converse.js and the prebind.
>
> I've integrated the chat in my webapp, but I don't have a clue about doing
> the prebind, it's driving me crazy.
>
> Thanks in advance.
>
> Daniel.
>
>
>
>
>>>
>>>
>>> On Wed, May 14, 2014 at 1:45 AM, Alexandre Coloma <acoloma@beeztel.com>wrote:
>>>
>>>> hi, i have implemented a chat with converse.js and prebind and works
>>>> great, but i have a problem if a cache connection betwen page transition,
>>>> when i attach to cached connection converse don't request for a presence
>>>> users state, how can i do this request? somebody has implemented the save
>>>> option (save state for users connected before reload page and stablish them
>>>> after reload?
>>>> thanks
>>>> Alex?
>>>>
>>>
>>>
>>
>

Re: [conversejs] cache connection

From:
Jc Brand
Date:
2014-05-14 @ 08:59
On Tue, May 13, 2014 at 10:15:03PM +0200, Alexandre Coloma wrote:
>    hi, i have implemented a chat with converse.js and prebind and works
>    great, but i have a problem if a cache connection betwen page transition,
>    when i attach to cached connection converse don't request for a presence
>    users state, how can i do this request?i

How do you cache the connection?

>    somebody has implemented the save
>    option (save state for users connected before reload page and stablish
>    them after reload?

Every time the page loads, the "onConnected" method should be called. In this
method, the roster is fetched again (this.connection.roster.get() ) which
should update the chat statuses of your contacts.

See here:
https://github.com/jcbrand/converse.js/blob/v0.7.4/converse.js#L520

Can you check whether this method gets called in your case or not?

It sounds like there might be a special case that converse.js doesn't take into
account, which I'd be happy to fix.

Regards
JC