sstrigler/JSJaC

Multiple tabs support

Closed this issue · 9 comments

Hi

Can the inherit method be used to inherit a connection made in one tab over multiple tabs. I tried doing that but it gives policy-violation error. If we inherit a connection will the connection that is inherited be closed
vidit

inherit method is used for code inheritance, it has nothing to do with tabs.

You have to open a new connection in each tab. This is not a problem with JSJaC but a browser limitation.

I guess this is about .inherit() which indeed is about inheriting the state of an already established connection (not as in object/code inheritance). Jack Moffit named it attach() in his strophejs AFAIK which is probably the better name. Still it can not be used simultaneously from within multiple instances of JSJaCConnection.

If you want to do multiple tabs use suspend() and resume() for the active tab (the one that has the focus). This can be tricky. Or use multiple resources , ie one unique resource per tab. Which can be tricky too. ;)

30 jul 2013 kl. 12:18 skrev Janusz Dziemidowicz notifications@github.com:

inherit method is used for code inheritance, it has nothing to do with tabs.

You have to open a new connection in each tab. This is not a problem with JSJaC but a browser limitation.


Reply to this email directly or view it on GitHub.

Somehow I was under really wrong impression, upon looking at the method it is quite obvious that I was wrong;)

To add to the topic, as Stefan said, single connection cannot be used simultaneously from multiple tabs. However, if your goal is to synchronize all sent/received messages across multiple tabs (which seems to be quite a popular feature) it can be accomplished using multiple connection and a server that support XEP-0280. This extension sends copies of all of the sent/received messages to all connection. It requires server side support though (ejabberd 3.x has such support in mod_carboncopy).

but strophe says that we ca start a connection on server and then attach it on multiple tabs so when we attach the connections is the connection still live in the server used to initially connect and if its still alive and then the new attached connection is used for communication why cant we attach a connection like that which is made by javascript and then attached or inherited in al the tabs the tabs

As stated previously, you cannot share a single BOSH "connection" across multiple tabs. I don't see anything like that in strophe documentation either.
A BOSH "connection" works by making multiple XHR calls from time to time. There is no way to share XHR objects across multiple tabs.

Exactly. This limitation is not implied by strophe or JSJaC but by their underlying protocol (BOSH). There is an unfinished proposal by Jack Moffit called BOSH session sharing which addresses this issue but it's not implemented officially as it has unresolved issues.
I once implemented it for a customer nevertheless as we were able to address the unresolved issues there on a custom basis. So given your use case there might be ways to share a single BOSH session amongst multiple tabs or not. But in any case it would require to modify server side components as well.

If that's not the route for you to go look into suspend/resume and javascript's onfocus handler.

30 jul 2013 kl. 23:52 skrev Janusz Dziemidowicz notifications@github.com:

As stated previously, you cannot share a single BOSH "connection" across multiple tabs. I don't see anything like that in strophe documentation either.
A BOSH "connection" works by making multiple XHR calls from time to time. There is no way to share XHR objects across multiple tabs.


Reply to this email directly or view it on GitHub.

I don't mind making changes to server can you point me to some pointer or suggest what changes i need to make in openfire server to accommodate multiple session..

I have already implemented the client side and hacked it to share same session in multiple tabs but the problem id that all the messages send by server are presently recieved by the main connection is there any way in which we can get these messages to be send to the browser which actually send the intial request

31 jul 2013 kl. 08:27 skrev vidit-bhatia notifications@github.com:

I have already implemented the client side and hacked it to share same session in multiple tabs

Using the multiple/different resource approach I assume?

but the problem id that all the messages send by server are presently recieved by the main connection is there any way in which we can get these messages to be send to the browser which actually send the intial request

You'd need to implement XEP-0280 (Message Carbons) as has already been pointed out. You might also be interested in XEP-0313 (Message Archive Management) in this regard.

I don't know about OpenFire but using MongooseIM (ejabberd) instead might help. There's an ongoing GSoC project for XEP-0313 which looks very promising (I'm a mentor). And also there is a commercial extension for XEP-0280 from Erlang Solutions (the company I'm working for).

Steve

Closing as this is not directly related to JSJaC and cannot be fixed.