A handler for things the protocol implementation will invoke

interface ProtocolHandler {
    generatePortID: ((localAddr: string, p: Remote<ProtocolHandler>) => PromiseVow<string>);
    onBind: ((port: Remote<Port>, localAddr: string, p: Remote<ProtocolHandler>) => PromiseVow<void>);
    onConnect: ((port: Remote<Port>, localAddr: string, remote: string, c: Remote<ConnectionHandler>, p: Remote<ProtocolHandler>) => PromiseVow<AttemptDescription>);
    onCreate: ((protocol: Remote<ProtocolImpl>, p: Remote<ProtocolHandler>) => PromiseVow<void>);
    onInstantiate: undefined | ((port: Remote<Port>, localAddr: string, remote: string, p: Remote<ProtocolHandler>) => PromiseVow<string>);
    onListen: ((port: Remote<Port>, localAddr: string, listenHandler: Remote<ListenHandler>, p: Remote<ProtocolHandler>) => PromiseVow<void>);
    onListenRemove: ((port: Remote<Port>, localAddr: string, listenHandler: Remote<ListenHandler>, p: Remote<ProtocolHandler>) => PromiseVow<void>);
    onRevoke: ((port: Remote<Port>, localAddr: string, p: Remote<ProtocolHandler>) => PromiseVow<void>);
}

Properties

generatePortID: ((localAddr: string, p: Remote<ProtocolHandler>) => PromiseVow<string>)

Create a fresh port identifier for this protocol

onBind: ((port: Remote<Port>, localAddr: string, p: Remote<ProtocolHandler>) => PromiseVow<void>)

A port will be bound

onConnect: ((port: Remote<Port>, localAddr: string, remote: string, c: Remote<ConnectionHandler>, p: Remote<ProtocolHandler>) => PromiseVow<AttemptDescription>)

A port initiates an outbound connection

onCreate: ((protocol: Remote<ProtocolImpl>, p: Remote<ProtocolHandler>) => PromiseVow<void>)

This protocol is created

onInstantiate: undefined | ((port: Remote<Port>, localAddr: string, remote: string, p: Remote<ProtocolHandler>) => PromiseVow<string>)

Return unique suffix for local address

onListen: ((port: Remote<Port>, localAddr: string, listenHandler: Remote<ListenHandler>, p: Remote<ProtocolHandler>) => PromiseVow<void>)

A port was listening

onListenRemove: ((port: Remote<Port>, localAddr: string, listenHandler: Remote<ListenHandler>, p: Remote<ProtocolHandler>) => PromiseVow<void>)

A port listener has been reset

onRevoke: ((port: Remote<Port>, localAddr: string, p: Remote<ProtocolHandler>) => PromiseVow<void>)

The port is being completely destroyed