Stand-alone example of proxy-wasm-cpp-host #346
Replies: 6 comments 5 replies
-
searching on Chat GPT , I got this reference https://github.com/proxy-wasm/proxy-wasm-cpp-host/tree/main/examples/http-filter and this usage example
I cannot find this in the tree. Is the "proxy-wasm-cli" available someplace else? |
Beta Was this translation helpful? Give feedback.
-
Hey there, I think one problem you'll run into is that the host is designed to be coupled to a network proxy. In essence ProxyWasm runs Wasm modules in response to events on a network proxy (e.g. on request, on response), making it hard to use "stand-alone". That said, there are a number of examples in the unit tests (test/ folder), and more examples for Wasm implementers are being developed. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response @martijneken . I understand that this is designed to be coupled with a network proxy. I was trying to see if theres is an example usage where I don't have to dig into a specific proxy code-base. One could still write a simple wrapper with a main (more like a cli) which can make some calls into the VM and dumps the results - that would be a good way to demonstrate the capabilities of this project. |
Beta Was this translation helpful? Give feedback.
-
I just sent this unit test PR to hopefully give you a starting point. It was useful for me as well. #348 Note that this doesn't have any HTTP header logic. For that you'll need to implement a Stream Context that implements HeaderInterface: |
Beta Was this translation helpful? Give feedback.
-
thanks everyone. This is my first time doing C++ (coming from the C world) - which makes it a bit harder to look at these projects. With @martijneken 's test-case pointer (thanks!), I was able to get a call going into the WASM, so I got past the first step. I plan to continue working on this further. I will post further questions/updates as I make progress. |
Beta Was this translation helpful? Give feedback.
-
Update: I have a fork https://github.com/bhakta0007/proxy-wasm-cpp-host I am working on a stand-alone utility on top of this project. My goal of building this was to understand how it works. I took most of the code from Apache Traffic Server project. If you guys find this interesting and useful, I can send a merge request to this project. [Of course the code needs a lot of cleanup!] |
Beta Was this translation helpful? Give feedback.
-
Looking for a stand-alone where this module is compiled to a working program demonstrating a simple working use-case. Is there one such example available?
I have seen the usage in projects like ATS - looking for a simple starter to understand the interactions.
Beta Was this translation helpful? Give feedback.
All reactions