Skip to main content

ProtocolConstructor

Type Alias ProtocolConstructor 

Source
pub type ProtocolConstructor = dyn Fn(PeerConn) -> Result<Arc<dyn Protocol>> + Send + Sync;
Expand description

User-supplied constructor handed to Node::attach_protocol. karyon calls it once per connected peer with a typed PeerConn scoped to this protocol. Capture whatever shared state the protocol needs in the closure.