annotate mod_http_stats_stream/README.markdown @ 3452:0c539092aa75

mod_storage_xmlarchive: Allow lookup of IDs that don't follow the YYYY-MM-DD-RANDOM format E.g. for converted archives where the IDs are preserved. This will be expensive.
author Kim Alvefur <zash@zash.se>
date Mon, 21 Jan 2019 19:17:49 +0100
parents c98b37d6d86c
children 740870196b97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2480
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 ---
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2 depends:
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 - 'mod\_http'
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 provides:
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 - http
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 ---
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 # Introduction
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 This module provides a streaming interface to [Prosodys internal statistics][doc:statistics] via
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 [Server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 ## Example
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 ```js
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 var evtSource = new EventSource("/stats_stream");
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 /*
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 * An event with all current statistics in the form of a JSON object.
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 * Normally sent only once, when first connected to the stream.
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 */
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 evtSource.addEventListener("stats-full", function(e) {
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 var initial_stats = JSON.parse(e.data);
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 console.log(initial_stats);
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 }, false);
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 /*
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28 * An event containing only statistics that have changed since the last
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 * 'stats-full' or 'stats-updated' event.
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 */
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31 evtSource.addEventListener("stats-updated", function(e) {
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 var updated_stats = JSON.parse(e.data);
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 console.log(updated_stats);
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34 }, false);
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 ```
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36
c98b37d6d86c mod_http_stats_stream: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37