I built a ComfyUi node that let you run a little paint program in another tab. (Sorry about the lack of updates if you use it. I intend to get back to it)

Negotiating the communication between tabs was by far the hardest part. In the end I ended up using local storage for signaling to establish a dedicated messsageport channel.

It was such a fight to make something that re-established the connection when either page reloaded.

There are still some connection issues that I haven't been able to resolve. It seems some browsers on some systems reject messages between tabs if they were loaded hours apart.

It might be worth benchmarking a pure local storage fallback, but I'm guessing it would suffer with high traffic.

A generalised implementation that allowed switching multiple paint programs and multiple ComfyUi pages would be ideal. A PubSub might be the way to go.

There's also the issue of other parts of the app also using local storage. Need to not step on toes.