Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CommunicationBindingProtocol

Defines a generic public API for transmitting Coaty communication events via specific broker-based or brokerless publish-subscribe messaging protocols.

Hierarchy

  • CommunicationBindingProtocol

Implemented by

Index

Properties

Readonly apiName

apiName: string

Defines the name of this binding used for identification and display purposes.

Readonly apiVersion

apiVersion: number

Defines the protocol version number of this binding, a positive integer.

Increment this version whenever you change or add new communication events or make breaking changes to the binding's messaging protocol.

Note that each specific binding type provides its own API versioning. API versions are not synchronized or shared across different binding types.

Readonly state

Gets the current lifecycle state of this communication binding.

Methods

createIoRoute

  • createIoRoute(ioSourceId: string): string
  • Create an IO route for routing IO values of the given IO source to associated IO actors.

    Parameters

    • ioSourceId: string

      object ID of an IoSource

    Returns string

    an associating topic for routing

join

on

  • on(event: "error" | "info" | "debug", listener: (msg: string) => void): void
  • on(event: "communicationState", listener: (state: CommunicationState) => void): void
  • on(event: "inboundEvent", listener: (eventLike: CommunicationEventLike) => void): void
  • Emitted whenever this binding signals an error, informational or debug message.

    remarks

    This event should be used in binding classes to log changes to connection state ("info"), errors ("error"), as well as publications and subscriptions/unsubscriptions ("debug").

    Parameters

    • event: "error" | "info" | "debug"
    • listener: (msg: string) => void
        • (msg: string): void
        • Parameters

          • msg: string

          Returns void

    Returns void

  • Emitted whenever the binding's communication state changes.

    remarks

    For bindings that use brokerless peer-to-peer messaging protocols the value emitted while the binding is joined is Online, if and only if the agent is not isolated, i.e. can communicate with other agents.

    Parameters

    Returns void

  • Emitted whenever an inbound communication event has arrived.

    For Raw events, the eventTypeFilter property contains the published topic name and the correlationId property contains the correlated subscription topic.

    For IoValue events, the eventTypeFilter property contains the IO route.

    Parameters

    Returns void

publish

  • Called by CommunicationManger to publish the given event.

    Publications issued before the binding has joined are deferred. Publications issued after the binding has unjoined are silently discarded.

    remarks

    Each binding must support publishing of all Coaty communication events except Raw and external IoValue events. If a binding doesn't support these, they are discarded and an error is emitted on the "error" event emitter.

    remarks

    A Raw event that specifies a publication topic with a Coaty-like shape is discarded and an error is emitted on the "error" event emitter.

    Parameters

    Returns void

subscribe

  • Called by CommunicationManger to subscribe the given event.

    Subscriptions issued before the binding has joined are deferred. Subscriptions issued after the binding has unjoined are silently discarded.

    remarks

    Each binding must support subscribing all Coaty communication events except Raw and external IoValue events. If a binding doesn't support these, they are discarded and an error is emitted on the "error" event emitter.

    remarks

    A Raw event that specifies a subscription topic with a Coaty-like shape is discarded and an error is emitted on the "error" event emitter.

    Parameters

    Returns void

unjoin

  • unjoin(): Promise<void>
  • Called by CommunicationManager once when this binding should leave the Coaty communication infrastructure and be disposed.

    The promise returned should always be resolved when the binding has completed unjoining so that its safe to invoke another join() operation on a new instance of this binding type.

    When unjoining, the binding instance should release all internally used resources so that it may be garbage collected. No further API method calls will be invoked on this binding.

    Returns Promise<void>

    a Promise that is always resolved when the binding has completed unjoining.

unsubscribe

  • Called by CommunicationManger to unsubscribe the given event.

    Unsubscriptions issued before the binding has joined are ignored. Unsubscriptions issued after the binding has unjoined are silently discarded.

    remarks

    Each binding must support unsubscribing all Coaty communication events except Raw and external IoValue events. If a binding doesn't support these, they are discarded and an error is emitted on the "error" event emitter.

    Parameters

    Returns void

Generated using TypeDoc