IoActorController
open class IoActorController : Controller
Provides convenience methods for observing IO values and for monitoring changes in the association state of specific IO actors.
-
Declaration
Swift
override open func onInit()
-
Declaration
Swift
override open func onCommunicationManagerStarting()
-
Declaration
Swift
override open func onCommunicationManagerStopping()
-
Listen to IO values for the given IO actor. The returned observable always emits the last value received for the given IO actor. When subscribed, the current value (or undefined if none exists yet) is emitted immediately.
Due to this behavior the cached value of the observable will also be emitted after reassociation. If this is not desired use
self.communicationManager.observeIoValue
instead. This method doesn’t cache any previously emitted value.Remark
Note that subscriptions on the observable returned must be manually unsubscribed by the application; they are not automatically unsubscribed when communication manager is stopped.
Declaration
Swift
public func observeIoValue(actor: IoActor) -> Observable<AnyCodable?>
Parameters
actor
an IO actor object
Return Value
an observable emitting IO values for the given actor
-
Gets the lastest IO value emitted to the given IO actor or
undefined
if none exists yet.Declaration
Swift
public func getIoValue(actor: IoActor) throws -> AnyCodable?
Parameters
actor
an IO actor object
Return Value
the latest IO value for the given actor if one exists
-
Listen to associations or disassociations for the given IO actor. The returned observable emits distinct boolean values until changed, i.e true when the first association is made and false, when the last association becomes disassociated. When subscribed, the current association state is emitted immediately.
Remark
Note that subscriptions on the observable returned must be manually unsubscribed by the application; they are not automatically unsubscribed when communication manager is stopped.
Declaration
Swift
public func observeAssociation(actor: IoActor) -> Observable<Bool>
Parameters
actor
an IO actor object
-
Determines whether the given IO actor is currently associated.
Declaration
Swift
public func isAssociated(actor: IoActor) throws -> Bool