Constructor
new Pinger(sessionId, network, periodPings, numberPings, proactive)
Constructor
Parameters:
Name | Type | Description |
---|---|---|
sessionId |
Number | The id of the session |
network |
ClientNetwork | ServerNetwork | Network object |
periodPings |
Number | Period in ms |
numberPings |
Number | Number of pings |
proactive |
Boolean | Should this pinger be the first |
Members
isActive :Boolean
This property describes whether this pinger is currently running
or it is not active. It means that the listeners are bound to
the network.
Type:
- Boolean
localMeas :Measure
The current local created measures.
Type:
- Measure
network :ClientNetwork|ServerNetwork
Network object which emits events with the messages. Can be used both
client and server network objects.
Type:
- ClientNetwork | ServerNetwork
numberPings :Number
Number of PING requests to be generated.
Type:
- Number
periodPings :Number
Time between outbound pings requests. In ms.
Type:
- Number
proactive :Boolean
Tells whether this pinger should start to send requests after start
or to wait to recieve the first ping and then start its own Pings.
Type:
- Boolean
recieveTime :Array
Array containing the arriving time of the Responses for the requests.
Type:
- Array
reporMeas :Measure
The reported measures from the other endpoint.
Type:
- Measure
reqTime :Array
Array containing the arriving time of the recieved Requests.
Type:
- Array
sendingTime :Array
Array containing the kickout time for Ping requests
Type:
- Array
sequence :Number
The sequence number which is included in every Request.
Type:
- Number
sessionId :Number
Session id of the session. It is included in every request
Type:
- Number
timer :NanoTimer
Timer
Type:
- NanoTimer
Methods
(static) genClient(sessionId, network, periodPings, numberPings) → {Pinger}
Generates a new pinger with Client settings.
Parameters:
Name | Type | Description |
---|---|---|
sessionId |
Number | The id of the session |
network |
ClientNetwork | ServerNetwork | Network object |
periodPings |
Number | Period in ms |
numberPings |
Number | Number of pings |
Returns:
- Type
- Pinger
(static) genServer(sessionId, network, periodPings, numberPings) → {Pinger}
Generates a new pinger with Server settings.
Parameters:
Name | Type | Description |
---|---|---|
sessionId |
Number | The id of the session |
network |
ClientNetwork | ServerNetwork | Network object |
periodPings |
Number | Period in ms |
numberPings |
Number | Number of pings |
Returns:
- Type
- Pinger
measure() → {Promise.<Object>}
Star the measurement stage. It will resolve the promise with the obtained
measures and the last reported metrics from the other end. May reject if
someone cancels the measure.
Returns:
The measures obtained.
- Type
- Promise.<Object>
stop()
Stop the pinger. If there is a measure ongoing there will not be any
action, if a measure is going it will stop abruptly. it resets the
pinger for another measure.