" (these is the default) a client would publish a message like so:
chat: //stats,20
The server will deliver a message back to the sending client:
chat: //stats-confirm Statistic id=99 started. Results due in 20s.
The inbound message is examined to see if it has the structure of a potential stats message. If a stats request is recognized, a new stats collection started, and the id of the stats collection and timestamp on the server is appended. Then, the server passes the message back to Bayeux so that it can be processed, and published out. At this point, the extension's send() method is called. If a stats request with an id and timestamp is recognized, the outbound message is modifed to be a probe message (_probeSentinel) and the sending time appended to the message. A client receives the probe message, and responds by publishing a reply (_probeReplySentinel). Continuing the example above, assuming we set _probeSentinel = "stats-probe", then each client will receive a message like:
chat: //stats-probe,20::--99::--1243945849978::--12345667464
Where ::-- are field delimiters, 99 is the id of the statistic collection underway and 1243945849978 is the time on the server the stats request was received, and 12345667464 is the server time at which the stats probe was published to all clients. The client responds with the same message, but prefixed by "//stats-reply":
chat: //stats-reply::--99::--1243945849978::--12345667464
The server receives the replies from each client, and updates the min,max and average statistics for:
- RoundTrip: time since the stats request was received on the server to stats-reply
- Application: time spent in the application between time stats request received to probe being published
- Infrastructure: time since probe published to reply received
- Cometd: portion of Infrastructure time that was due to cometd processing (estimate based on TimesyncExtension network lag calculation)
In other words, if T0 is the time at which the original stats request is received on the server, and T1 is the time at which the stats probe is sent, and T2 is the time the probe reply is received:
- RoundTrip = T2-T0
- Application = T1-T0
- Infrastructure = T2-T1
- Cometd = Infrastructure - Lag
After waiting the prescribed interval, eg 20 secs, to collect as many of the clients' messages as possible, it sends a message to the client who originated the statistics request with the results, eg:
chat://stats-results Id 2: samples=1, avgR=43, minR=43, maxR=43, avgI=42, minI=42, maxI=42, avgA=1, minA=1, maxA=1, avgC=42, minC=42, maxC=42
Note that there can be many stats collections in progress at once.