PayloadReceiver class

Payload receiver for streaming.

Properties

disconnected
isConnected

Get current connected state

Methods

connect(ITransportReceiver)

Connects to a transport receiver

disconnect(TransportDisconnectedEvent)

Force this receiver to disconnect.

subscribe((header: IHeader) => SubscribableStream, (header: IHeader, stream: SubscribableStream, count: number) => void)

Allows subscribing to this receiver in order to be notified when new data comes in.

Property Details

disconnected

disconnected?: TransportDisconnectedEventHandler

Property Value

isConnected

Get current connected state

boolean isConnected

Property Value

boolean

true if connected to a transport sender.

Method Details

connect(ITransportReceiver)

Connects to a transport receiver

function connect(receiver: ITransportReceiver): Promise<void>

Parameters

receiver
ITransportReceiver

The ITransportReceiver object to pull incoming data from.

Returns

Promise<void>

a promise that resolves when the receiver is complete

disconnect(TransportDisconnectedEvent)

Force this receiver to disconnect.

function disconnect(event?: TransportDisconnectedEvent)

Parameters

event
TransportDisconnectedEvent

Event arguments to include when broadcasting disconnection event.

subscribe((header: IHeader) => SubscribableStream, (header: IHeader, stream: SubscribableStream, count: number) => void)

Allows subscribing to this receiver in order to be notified when new data comes in.

function subscribe(getStream: (header: IHeader) => SubscribableStream, receiveAction: (header: IHeader, stream: SubscribableStream, count: number) => void)

Parameters

getStream

(header: IHeader) => SubscribableStream

Callback when a new stream has been received.

receiveAction

(header: IHeader, stream: SubscribableStream, count: number) => void

Callback when a new message has been received.