wingify / across-tabs

Easy communication between cross-origin browser tabs. Simplified "CORS"ing!

Home Page:https://engineering.wingify.com/across-tabs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If parent is disconnect can child opt for new parent?

vividvilla opened this issue · comments

When parent tab gets reloaded the context is lost hence the child disconnects. So once current parent disconnects is it possible to look for new parent (if there are multiple parent active) ?

Once the parent is reloaded, the references of the opened child tabs are lost, so Parent can send the messages to the orphaned tabs. But child still has the reference of the parent tab, so child tab can still send a message to the reloaded Parent tab via child.sendMessageToParent(data);. Once parent receives the orphaned child message, it can again establish a connection.

"if there are multiple parent active" - How can this be possible? A tab/window can be opened by clicking on some link. So, there can only be one parent. But a parent tab can have as many child tabs as the browser supports.

Hope this clarifies your doubt.

You can try this by running the example.

  1. Clone the repo
  2. npm/yarn install
  3. run two local servers i.e. pythom -m SimpleHTTPServer 9000 and pythom -m SimpleHTTPServer 3000.
  4. Open localhost:9000 and try the above mentioned scenario.

Once parent receives the orphaned child message, it can again establish a connection.

Is this done just by a parent receiving an orphaned child message? Or does the parent have to actively do something? I could not get this to work

Hello, sorry to reopen this issue but I didn’t understand the answer.
If the parent disconnect, is there a way that a child become parent for other orphaned children ?

Once parent loses it is unable to connect again with the child, can you please tell me the steps how to connect with parent again after loosing the connections