This reminds me of the ScriptMethod thing that asp.net has in the early days of AJAX. Was fun to use it, but didn’t stand the test of time.
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/...Maybe there has been enough changes in the ecosystem now to be able to abstract network and write code that’s not too brittle.