DittoBusStream

class DittoBusStream

A message-based communication channel to another peer in the mesh.

When a DittoBusStream is received by any means, you must immediately set callbacks. This provides the notifications of incoming messages and other events.

Outgoing messages can be enqueued using enqueueMessage(). You must wait for the callback method indicating that the enqueue was successful before calling this method again. This process provides backpressure so that your app does not send data more quickly than the network can deliver.

Functions

Link copied to clipboard
fun close()

Close this stream in both directions.

Link copied to clipboard
fun enqueueMessage(data: ByteArray)
Link copied to clipboard
fun isReady(): Boolean

true if enqueueMessage may be called at this time and false if there is a send pending.

Properties

Link copied to clipboard
var callback: DittoBusStreamCallback? = null

Callbacks for events relating to this stream.

Link copied to clipboard
val reliability: DittoBusReliability

The reliability mode under which this stream is operating.

Link copied to clipboard
val streamID: BigInteger

An ID unique to the local device that can be used to track this individual stream.