try icon indicating copy to clipboard operation
try copied to clipboard

Provide documentation for using wasm "mode"

Open damageboy opened this issue 6 years ago • 6 comments

Hi, It's pretty clear that https://dotnet.microsoft.com/platform/try-dotnet is using something different than the global dotnet-try tool. When I load up the chrome developer tools I clearly see that somehow, magically, mono.wasm is being used: image

At the same time, the dotnet-try global tool seems to work very differently: image

and there seems to be no mono.wasm being loaded/ used.

I'd like for some guidance / documentation to be provided on how to get a mono.wasm / blazor enabled so I can host runnable documentation in a static web-site without needing to use server side resources...

I'm working on a blog series and would love to host some runnable docs / code and provide them to people reading the posts and wanting to play with the code. I don't mind going through less-than ready code or instructions, but it would be great if at the very least so pointers to how to get this obviously working feature of dotnet-try off the ground!

damageboy avatar Aug 19 '19 08:08 damageboy

@damageboy It's not quite purely "static". True, the wasm dependencies are served in a static manner, but we still compile the user's code serverside. The basic flow is:

  • editor JavaScript served statically and configured to run code using wasm
  • editor JS code creates a hidden iframe that loads Wasm/Framework (served statically)
  • user clicks run
  • editor calls a service to compile the user code, service returns a base64-encoded DLL
  • editor communicates with iframe that loaded wasm to send it the dll/waits for wasm to run the code/prints console output to user

All the parts you need to implement the above are available in dotnet-try if you want to host your own service.

rchande avatar Sep 10 '19 23:09 rchande

@rchande Thanks for the explanation!

damageboy avatar Sep 11 '19 06:09 damageboy

@damageboy Let me know if you're interested in exploring that avenue, I can probably provide some guidance.

rchande avatar Sep 12 '19 16:09 rchande

I’m definitely interested and I’ve actually tried to do it on my own to some extent....

Maybe I was too optimistic but I tried to compile and run the MLS.Blazor project on the next after upgrading to preview9...

So far I couldn’t get anything off the ground.

So help will surely push me a long ways forward...

On Thu, 12 Sep 2019 at 19:12 Ravi Chande [email protected] wrote:

@damageboy https://github.com/damageboy Let me know if you're interested in exploring that avenue, I can probably provide some guidance.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dotnet/try/issues/382?email_source=notifications&email_token=AAA6WIUVWFL6TRSIOMU25ETQJJS7PA5CNFSM4IMZ33X2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6SNTWQ#issuecomment-530897370, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6WIQLFZXCOFKOG5QHVOLQJJS7PANCNFSM4IMZ33XQ .

--

Shechter.

damageboy avatar Sep 12 '19 16:09 damageboy

There were actually some breaking changes between Preview 8 and Preview 9--our builds still depend on Preview 8.

rchande avatar Sep 12 '19 16:09 rchande

OK, Is there anything else I should be aware of? Is MLB.Blazor a single project that constitutes a running example that should be useful? I just took the only thing with Blazor in its name assuming it's the wasm code generator and it might be my entry point.

damageboy avatar Sep 13 '19 05:09 damageboy