Inter-App Communication
This section describes how a custom subprotocol can be implemented for allowing communication between different applications.
public class CustomHandler : ITalkReqAndRespHandler
{
public byte[]? HandleRequest(byte[] protocol, byte[] request)
{
// Handle the incoming TalkReq request here
// Return response payload or null
}
public byte[]? HandleResponse(byte[] response)
{
// Handle the incoming TalkResp response here
// Return processed response or null
}
}ITalkReqAndRespHandler customHandler = new CustomHandler();
Discv5Protocol discv5 = Discv5Builder.CreateDefault(bootstrapEnrs, customHandler);Discv5Protocol discv5 = new Discv5Builder()
.WithConnectionOptions(connectionOptions)
.WithSessionOptions(sessionOptions)
.WithTableOptions(tableOptions)
.WithBootstrapEnrs(bootstrapEnrs)
.WithEnrBuilder(enrBuilder)
.WithEnrEntryRegistry(enrEntryRegistry)
.WithLoggerFactory(loggerFactory)
.WithTalkResponder(customHandler) // Custom handler
.Build();Last updated