@oazmi/kitchensink - v0.10.1
    Preparing search index...

    Class NetConnSink<BASE>

    a net-connection sink traps certain messages received from specific hostnames (ip-addresses), while queuing the rest of messages elsewhere.

    you can think of it as network-connection with a builtin hostname filter system, allowing you prioritize the reading of incoming messages from a certain hostname, and later take care of the remaining un-organized/untrapped set of messages, when nothing of high-priority is taking place.

    the way it works is that you must first set a hostname "trap" via the the trapAddr method, and then, to read incoming messages coming from hostname, you will use the readAddr method to receive the messages, one at a time.

    Type Parameters

    Implements

    Index

    Constructors

    Properties

    base: BASE
    trapped: NetConnSink_traps = {}
    size: number

    the buffer size of the underlying Uint8Array of this connection.

    when you receive a buffer of this size from the read method, it might be an indication that there are already more remaining bytes available that could to be read.

    abortController: AbortController

    Methods

    • returns the number of remaining untrapped unread messages. the value may be negative, indicating that one or more things have already requested to snatch the message as soon as it comes.

      Returns number

    • send the contents of the array buffer to a host with the addr network-address, over your connection.

      resolves to the number of bytes written. though it is kind of pointless given the TODO conundrum below:

      TODO: what should we do about input buffers that are not entirely sent in a single packet? should the implementation loop until all of it has been sent? or should it be up to the user of this interface to do that on their own?

      for now, I will enforce the rule that the send method must completely send the buffer before resolving its promise. it really makes things simpler for the end user, and it only adds one line of code for underlying implementations that do not necessarily send their buffer all in one go.

      Parameters

      Returns Promise<number>