Optional
handlerThe handler is responsible for processing incoming requests and sending outgoing responses.
The type of network being used
The serializer is responsible for encoding and decoding packets. This is the piece of logic responsible for communicating directly with the wire format for whatever network protocol is used by the network interface.
Begin listening for incoming requests.
The listen method should be able to effectively bootstrap the network interface without accepting additional parameters. This is to support polymorphic startups across a variety of network interfaces without needing to know the specifics of each.
For example, some network interfaces may bind an array of ports, while others
may bind to a single port and address. The listen
method should be able to simply call
without needing to know the specifics of the network interface.
Optional
callback: (() => void)The callback to call when the network interface is ready to receive requests
Network defines the interaction layer between the server and the network. It is responsible for parsing incoming requests and serializing outgoing responses.
The network interface is extensible to any network protocol, such as TCP, UDP, or HTTP.
Network should define basic methods to handle incoming requests and send outgoing responses.