dart-lang / site-www

Source for Dart website
https://dart.dev
Other
936 stars 675 forks source link

Add beginner-friendly communication samples for HTTP/(Web)Socket implementation #5705

Open projektorius96 opened 2 months ago

projektorius96 commented 2 months ago

What information needs to be added?

Learning Dart (as I still do), I wrote myself a simple implementation of WebSocket-based ping-pong server to depict the proof-of-concept communication between Dart host (server) and the browser that supports WebSocket API (sample). Mundane example would be "state management" solution outside browser that encompasses Dart ecosystem and powerful service workers on browser-of-choice end.

Where should this new content appear?

Genuinely, a good place would be an idiomatic Development/Web Apps/Communication (or top-level "Guides" section).

Cheers ! ♥

I would like to fix this problem.

projektorius96 commented 2 months ago

Hi, @parlough . I have just written a native messaging host implementation, you can see the tip-of-tree, it is Windows-users oriented, but just with a few tweaks as described in specification, could be adjusted for Linux/Mac users respectively.

I am tagging @MaryaBelanger as this is technically could be used in tandem with package:chrome_extension, so again "How to use JS interop" would contribute to better understanding of how to port the Chrome extension's JavaScript codebase to Dart syntax, decreasing JavaScript consumption to minimum.

To encompass the advantage of using NMH over the formerly suggested WebSocket-based implementation of mine. is that NMH has a tendency to better keeping Chrome extension service worker being alive. The disadvantage that it requires a bit more of the setup especially for Windows users as touching registry should be last resort, better never at all 😆

Cheers ! 👍🏼