How to handle HTTP request callback in "on_tick" method
pjjwpc opened this issue · comments
pjjwpc commented
fn on_tick(&mut self) {
unsafe {
self.dispatch_http_call(
&VM_CONFIG_GLBOAL.gatewaycluster,
vec![
(":method", "GET"),
(
":path",
"/hello",
),
(":authority","hello"),
],
None,
vec![],
Duration::from_secs(1),
)
.unwrap();
}
}
ismail BASKIN commented
impl Context for PluginRootContext {
fn on_http_call_response(&mut self, _token_id: u32, _num_headers: usize, _body_size: usize, _num_trailers: usize) {
/*
The code that handles dispatched http response
*/
}
}
impl RootContext for PluginRootContext {
fn on_tick(&mut self) {
self.dispatch_http_call(...);
}
}
pjjwpc commented
thanks @ismailbaskin