hxn

AssetStream

  • Type parameters: T

A pull stream of decoded messages or chunks, with one pending read at a time.

Constructor

function new(driver:AssetStreamDriver, decode:(Bytes) -> T)

Methods

function map(convert:(T) -> U):AssetStream<U>

Mapped views share the same connection; closing one closes them all.

function listen(onItem:(T) -> Void, ?onEnd:() -> Void, ?onError:(Exception) -> Void):() -> Void

Continuously pulls after each synchronous handler returns; returns a cancellation function.

function close():Void

Cancels pending reads; listeners finish normally on an explicit close.