PayloadAssemblerManager class
Orchestrates assembly of payloads.
Constructors
Methods
get |
Retrieves the assembler's payload as a stream. |
on |
The action the assembler executes when new bytes are received on the incoming stream. |
Constructor Details
PayloadAssemblerManager(StreamManager, (id: string, receiveResponse: IReceiveResponse) => Promise<void>, (id: string, receiveRequest: IReceiveRequest) => Promise<void>)
Initializes a new instance of the PayloadAssemblerManager class.
new PayloadAssemblerManager(streamManager: StreamManager, onReceiveResponse: (id: string, receiveResponse: IReceiveResponse) => Promise<void>, onReceiveRequest: (id: string, receiveRequest: IReceiveRequest) => Promise<void>)
Parameters
- streamManager
- StreamManager
The StreamManager managing the stream being assembled.
- onReceiveResponse
-
(id: string, receiveResponse: IReceiveResponse) => Promise<void>
Function that executes when new bytes are received on a response
stream.
- onReceiveRequest
-
(id: string, receiveRequest: IReceiveRequest) => Promise<void>
Function that executes when new bytes are received on a request
stream.
Method Details
getPayloadStream(IHeader)
Retrieves the assembler's payload as a stream.
function getPayloadStream(header: IHeader): SubscribableStream
Parameters
- header
- IHeader
The Header of the Stream to retrieve.
Returns
A SubscribableStream of the assembler's payload.
onReceive(IHeader, SubscribableStream, number)
The action the assembler executes when new bytes are received on the incoming stream.
function onReceive(header: IHeader, contentStream: SubscribableStream, contentLength: number)
Parameters
- header
- IHeader
The stream's Header.
- contentStream
- SubscribableStream
The incoming stream being assembled.
- contentLength
-
number
The length of the stream, if finite.