pxt icon indicating copy to clipboard operation
pxt copied to clipboard

Simulator: fix for cross-domain bidirectional multiplayer messages

Open eanders-ms opened this issue 2 years ago • 0 comments

Hosting the simulator within another app is a multiple nested iframe situation. The middle frame - run.html - has the responsibility of marshaling multiplayer message traffic to/from the simulator component, which is hosted in a child iframe. Because multiplayer messaging is bidirectional, traffic passing through the middle frame's singular event handler must be explicitly routed inbound or outbound.

In development, things were working fine on localhost without this routing, but I'm not certain why. There might be a special case somewhere, or the same-origin nature of localhost resulted in different behavior. In any case, this change makes it work in both scenarios.

eanders-ms avatar May 04 '22 14:05 eanders-ms