Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎁 seed inside IFrame #256

Closed
3 tasks done
idanilt opened this issue Jul 9, 2020 · 1 comment · Fixed by #263
Closed
3 tasks done

🎁 seed inside IFrame #256

idanilt opened this issue Jul 9, 2020 · 1 comment · Fixed by #263

Comments

@idanilt
Copy link
Contributor

idanilt commented Jul 9, 2020

General description

Right now we assume the seed inside the main thread and the IFrame contain only services.
Some times the entire application will be inside the IFrame, in this case, the service won't find the seed because it sends messages to the top window

example: https://codesandbox.io/s/scalecube-js-tutorial-bwtl7

API

Design description

A clear and concise description of the design proposition.

  1. Is it a breaking change (not backward compatible)? no
  2. Is it adds a new API? no
  3. Is it changes existing API? no
  4. Is it removes existing API? no

Changes

Provide a link to a PR or code snippet of old and new API.

Selected solution

Create micro lib for addressable post messages and use it in cluster and transport
Advantages

  • Simplify cluster and transport
  • Robust
  • Support more use cases
  • Testable

Downside

  • Lot of work

Alternative solutions:

Self & Top

In this approach, we will try sending events on self and top
Advantages

  • Simple to implement
  • It will work out of the box
    Downside
  • Hacky and not working properly

Manual piping

In this approach, we won't assume the seed is in the to and we use a utility to pipe event to the top
Advantages

  • Simple to implement

Downside

  • the developers need to do something active to make it work
  • Break existing applications

Addressing

In this approach, we send messages according to the seed address
Downside

  • not simple to implement
  • Creating a convention that isn't standard
  • The user needs to know how to config it

Behavior

Consideration

We should still support seed on main thread and services on IFrame

  • this change will affect cluster-browser and affect only browsers

Current behavior (should be maintained)

Given seed on the main thread
When ServiceA added on IFrame
Then it should connect seed

Desired behavior

Given seed on IFrame
When ServiceA added on IFrame
Then it should connect seed

Test cases

Scenario: seed on the main thread service on IFrame
Scenario: seed on IFrame service on IFrame
Scenario: nested IFrames

RoadMap

@katzIdo
Copy link
Collaborator

katzIdo commented Jul 11, 2020

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants