Stream: wasmtime

Topic: Support for Server Sent Events?


view this post on Zulip Kevin (Jul 11 2022 at 11:22):

Hi, is there any support for using Server Sent Events (SSE) with rust to webassembly on the client side? The websys crate has web_sys::EventSource which enables this by using JavaScript interop, but I can't find anything similar when using the wit-bindgen crate. There are a few crates for using SSE in pure rust here: https://crates.io/keywords/server-sent-events. But when I try to include any of them as a dependency in the Cargo.toml file, I get compilation errors.

view this post on Zulip bjorn3 (Jul 11 2022 at 15:02):

wasm-bindgen and by extension web-sys is for usage in the browser and allows you to bind to arbitrary javascript api's. wit-bindgen can be used in the browser, but you are yourself responsible for writing the glue code with the browser api's in that case.

view this post on Zulip bjorn3 (Jul 11 2022 at 15:03):

The crates you are referencing are for usage of server sent events as client outside of the browser.

view this post on Zulip Kevin (Jul 13 2022 at 14:29):

I see, the idea was to use client server sent events outside of the browser with webassembly. But as I understand, this kind of networking is not yet supported.


Last updated: Nov 22 2024 at 16:03 UTC