How should plugins perform any type of IPC / I/O (especially HTTP, databases)? #2838
|
Hi! I’m currently working on a Pumpkin plugin and I’m trying to find a way for plugins to communicate with any external service. Since Pumpkin plugins run as WASM, I’m not sure how I should do http requests to a backend. For example, I have a separate http backend that I’d like my plugin to use to access the database. Normally in Rust I’d use something like reqwest, but since the plugin runs in the WASM environment it doesn't work. With some digging I found the http permission for plugins and some lines where it's checked. I also found that wasmtime-wasi-http was linked against the wasm build. But there is no mentioning of outgoing http nor networking at all in the wit files and no api in the plugin library. I feel like I'm missing something. I mainly want to understand the intended architecture and not necessarily request a new feature. Thanks! |
Replies: 2 comments 1 reply
|
You are not missing a Pumpkin-specific HTTP function. The host side is wired for the standard WASI HTTP interface: the permission constant is The missing piece is guest-side ergonomics. Pumpkin's domain WIT files do not need to redefine The intended architecture is therefore:
Direct database sockets would require the broader Until Pumpkin publishes a guest example, I would open a narrowly scoped documentation/example issue asking for a minimal outbound GET plugin. That will also confirm the supported Rust client/toolchain versions; the host capability exists, but the public plugin SDK currently leaves that integration step to plugin authors. |
|
If the question is just about HTTP specifically, then yeah, we enable standard Specifically for Rust plugins, two libraries that provide convenient wrappers are |
You are not missing a Pumpkin-specific HTTP function. The host side is wired for the standard WASI HTTP interface: the permission constant is
http.outbound, and the loader setswasi_http_hooks.allow_outbound = truewhen that permission is granted (host code, permission definition).The missing piece is guest-side ergonomics. Pumpkin's domain WIT files do not need to redefine
wasi:http; a component can import the standardwasi:http/outgoing-handlerinterface separately. However, the plugin crate currently does not appear to expose a ready-made client or example for doing that. A normal nativereqwestbuild will not automatically become a WASI HTTP component client.The intended architectur…