Hi 

I am trying to implement a dynamic API. I have followed the suggestions in 
https://groups.google.com/g/capnproto/c/Ivl3u4JJoEQ/m/MIH2a2nPBQAJ and 
https://groups.google.com/g/capnproto/c/fNnr3Om9haM/m/1TdBqwsNBwAJ

My implementation attempt lies at 
https://github.com/DaneSlattery/capnp_generic_poc .

The desired data flow is as follows:

1. A client connects to a server, and receives a capability that allows the 
client to load a schema (the InterfaceLoader). When connecting, the client 
also passes a ClientInterface to the server.
2. The client registers a schema using the InterfaceLoader. The client must 
send a Schema.Node parameter to the server. The server must load the schema.
3. The server uses the given loaded schema to communicate with the client 
interface, which takes a parameter of AnyStruct.

I have a few problems:

Firstly, when the client attempts to set the schema using  
capnp::Schema::from<Message>().getProto() , line 683 of 
capnproto-c++-0.10.3/src/capnp/dynamic.c++ blows up. I have changed this 
line to, instead assessing the ID of the schema for equality :
KJ_REQUIRE(structValue.getSchema().getProto().getId() == 
structType.getProto().getId(), "Value type mismatch.")
{
return;
}
I think this change should perhaps go in a PR, unless there is another, 
better way.

Secondly, I can't figure out how to send messages of the loaded schema back 
from the server to the client. Can anyone see if the POC linked is viable, 
and how to get to the final step?

- Dane

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/4e26ccf6-67bf-43e5-8f31-f8b582a7c304n%40googlegroups.com.

Reply via email to