ProtocolAdapter class

Creates a protocol adapter for Streaming.

Constructors

ProtocolAdapter(RequestHandler, RequestManager, PayloadSender, PayloadReceiver)

Creates a new instance of the protocol adapter class.

Methods

onCancelStream(PayloadAssembler)

Executes the receive pipeline when a cancellation comes in.

onReceiveRequest(string, IReceiveRequest)

Executes the receive pipeline when a request comes in.

onReceiveResponse(string, IReceiveResponse)

Executes the receive pipeline when a response comes in.

sendRequest(StreamingRequest)

Sends a request over the attached request manager.

Constructor Details

ProtocolAdapter(RequestHandler, RequestManager, PayloadSender, PayloadReceiver)

Creates a new instance of the protocol adapter class.

new ProtocolAdapter(requestHandler: RequestHandler, requestManager: RequestManager, sender: PayloadSender, receiver: PayloadReceiver)

Parameters

requestHandler
RequestHandler

The RequestHandler that will process incoming requests.

requestManager
RequestManager

The RequestManager that will process outgoing requests.

sender
PayloadSender

The PayloadSender for use with outgoing requests.

receiver
PayloadReceiver

The PayloadReceiver for use with incoming requests.

Method Details

onCancelStream(PayloadAssembler)

Executes the receive pipeline when a cancellation comes in.

function onCancelStream(contentStreamAssembler: PayloadAssembler)

Parameters

contentStreamAssembler
PayloadAssembler

The payload assembler processing the incoming data that this cancellation request targets.

onReceiveRequest(string, IReceiveRequest)

Executes the receive pipeline when a request comes in.

function onReceiveRequest(id: string, request: IReceiveRequest): Promise<void>

Parameters

id

string

The id the resources created for the response will be assigned.

request
IReceiveRequest

The incoming request to process.

Returns

Promise<void>

onReceiveResponse(string, IReceiveResponse)

Executes the receive pipeline when a response comes in.

function onReceiveResponse(id: string, response: IReceiveResponse): Promise<void>

Parameters

id

string

The id the resources created for the response will be assigned.

response
IReceiveResponse

The incoming response to process.

Returns

Promise<void>

sendRequest(StreamingRequest)

Sends a request over the attached request manager.

function sendRequest(request: StreamingRequest): Promise<IReceiveResponse>

Parameters

request
StreamingRequest

The outgoing request to send.

Returns

Promise<IReceiveResponse>

The response to the specified request.