dispatcher.connectivityManager.INopeConnectivityManager - ZeMA-gGmbH/NoPE-JS GitHub Wiki

Interface: INopeConnectivityManager

dispatcher.connectivityManager.INopeConnectivityManager

A connectivityManager observes the connection to various dispatchers. This element displays all found dispatchers in the network (if there are no others only itself) in the dispatchers property. It manages the status (dead, slow, warn, alive) of the other dispatchers.

The manager uses a bridge ICommunicationBridge to search for new dispatchers. When a link layer connection is established via the bridge, a so-called bonjour message is sent. With this message all dispatchers in a network register themselves. If such a message is sent, all other dispatchers report their current status. Thus all dispatchers are known to each other.

The connectivityManager checks their status time-based. To do this, all ConnectivityManagerssend each other alivemessage (aheartbeat`) defined time interval. This can be used to monitor when a dispatcher last checked in. If this exceeds a certain time interval, that dispatcher is first classified as 'slow' and then as 'dead'. If the dispatcher does not check in after a defined time interval, it is removed.

The described changes can be observed using the dispatchers property.

In addition, the connectivityManager allows synchronization of timestamps with other systems (usually other dispatchers). This is useful when different systems store sensor data, for example. The timestamp is calculated with a delay, which can be determined during pings.

  • You can get a sync timestamp using the now property.

The connectivityManager provides properties that simplify the collection of some information:

  • getStatus to get the status of a particular dispatcher.
  • getAllHosts: to get all hosts on the network. (It is possible that several nope runtimes are running on the same host)
  • upTime: since when the Connectivity Manager is running.

Sometimes it is useful to define a master in the network with nope runtime, (e.g. time synchronization). For this the flag master can be set to true or false. This sets the master mode of the connectivityManager manually. If it is set to null, the master is determined automatically and the connectivityManager could be a master. The selection of the master is based on the operation time and the connection time.

For better understanding please read the 13-ConnectivityManager Jupyter notebook in the wiki-section! *

Implemented by

Properties

connectedSince

Readonly connectedSince: number

Timestamp of the connection since it has been established.

Author

M.Karkowski

Memberof

INopeConnectivityManager


dispatchers

dispatchers: IMapBasedMergeData<string, INopeStatusInfo, string, string>

Mapping for the External Dispatchers. You can use the Event, onChange, to get the latest changes. Use the "data" field, to subscribe for the latest data.

OriginalKey = Dispatcher ID; OriginalValue = INopeStatusInfo; ExtractedKey = Dispatcher ID; ExtractedValue = Dispatcher ID;

Author

M.Karkowski

Memberof

INopeStatusManager


id

Readonly id: string

The utilized ID, which will be used for the Status Messages etc.

Author

M.Karkowski

Memberof

INopeStatusManager


info

Readonly info: INopeStatusInfo

The current info of this connectivity-manager.

Author

M.Karkowski

Memberof

INopeConnectivityManager


isMaster

isMaster: boolean

Flag, showing, that we

Author

M.Karkowski

Memberof

INopeDispatcher


master

Readonly master: INopeStatusInfo

Returns the Status of the Master.

Author

M.Karkowski

Memberof

INopeConnectivityManager


now

Readonly now: number

Returns the current timestamp.

Author

M.Karkowski

Memberof

INopeConnectivityManager


options

options: INopeINopeConnectivityOptions

Options of the StatusManager.

Author

M.Karkowski

Memberof

INopeStatusManager


ready

ready: INopeObservable<boolean, boolean, boolean, IEventAdditionalData>

Flag, to show, that the System is ready

Author

M.Karkowski

Memberof

INopeStatusManager


upTime

Readonly upTime: number

The time since the systeme is connected.

Author

M.Karkowski

Memberof

INopeConnectivityManager

Methods

dispose

dispose(quiet?): Promise<void>

Disposes the StatusManager and thereby,

Author

M.Karkowski

Memberof

INopeStatusManager

Parameters

Name Type
quiet? boolean

Returns

Promise<void>

{Promise}


emitBonjour

emitBonjour(): Promise<void>

Emitts a Bonjour Message.

Author

M.Karkowski

Memberof

INopeStatusManager

Returns

Promise<void>

{Promise}


getAllHosts

getAllHosts(): string[]

Returns all connected Hosts.

Author

M.Karkowski

Memberof

INopeConnectivityManager

Returns

string[]

{string[]}


getStatus

getStatus(id): INopeStatusInfo

Returns the Status of an other Manager.

Author

M.Karkowski

Memberof

INopeStatusManager

Parameters

Name Type
id string

Returns

INopeStatusInfo

{INopeStatusInfo}


reset

reset(): void

Resets the System

Author

M.Karkowski

Memberof

INopeStatusManager

Returns

void


setTimings

setTimings(options): void

Adapts the Timing Options and resets the internally used Timers etc.

Author

M.Karkowski

Memberof

INopeStatusManager

Parameters

Name Type
options Partial<INopeINopeConnectivityTimeOptions>

Returns

void


syncTime

syncTime(timestamp, delay?): void

Helper function, which will synchronize the Timestamp. Timestamp must be provided in UTC (https://www.timeanddate.de/stadt/info/zeitzone/utc)

Author

M.Karkowski

Memberof

INopeStatusManager

Parameters

Name Type Description
timestamp number The UTC-Timestamp
delay? number The Delay, since the Timestamp has been generated

Returns

void


toDescription

toDescription(): Object

Function to describe the System.

Returns

Object

Name Type
dispatchers string[]
⚠️ **GitHub.com Fallback** ⚠️