Hello All,
I am trying to pass client capability to sever, client should receive notify back on any updates.
In my application, Service is sending statusHearbeat continuously, but client receives callback only when it is waiting on any promise. Could anyone please guide on how to receives callback from server? My client application is running on windows.
For e.g only duration when i am blocked on wait() call, i see callback gets received and dispatchCall is triggered
This call is done from client -> server
auto request = connect->directorRef->versionRequest();
auto responsePromise = request.send();
auto response =
responsePromise.wait(connect->clientRef->getWaitScope());
e.g interface FaTfServerToClient {
statusHeartbeat @0 () -> ();
}
interface FaTfClientToServer {
version @0 () -> (version :Base.Version);
}
Client connection---> I am passing client bootstrap TransformEventHandler object
auto address = connect->ioContext.provider->getNetwork()
.parseAddress(ipAddress, port).wait(connect->ioContext.waitScope);
connect->connection = address->connect().wait(connect->ioContext.waitScope);
connect->clientRef = std::make_shared<capnp::TwoPartyClient>(*(connect->connection), kj::heap<TransformEventHandler>(observer),
capnp::schemas::Side_9fd69ebc87b9719c::CLIENT);
connect->directorRef = std::make_shared<FaTfClientToServer::Client>(connect->clientRef->bootstrap().castAs<
FaTfClientToServer >());
class TransformEventHandler : public FaTfServerToClient::Server, public EventHandler {
::kj::Promise<void> statusHeartbeat(StatusHeartbeatContext context) override {
std::cout << "status heartbeat" << std::endl;
return kj::READY_NOW;
}
}
I tried adding another iocontext, client in different thread and ran wait() on that. It doesnt receive nothing.
Looks like i haven't understood basic mechanism!! Any pointers would be very helpful. Thanks