108 update_have_clients(); |
108 update_have_clients(); |
109 end |
109 end |
110 |
110 |
111 function handle_active(event, path) |
111 function handle_active(event, path) |
112 mark_active(event.request); |
112 mark_active(event.request); |
|
113 event.response.headers.content_type = "text/plain"; |
113 return "OK"; |
114 return "OK"; |
114 end |
115 end |
115 |
116 |
116 function handle_watchers(event) |
117 function handle_watchers(event) |
117 local active, total = 0, 0; |
118 local active, total = 0, 0; |
135 age = math.floor(age_sec); |
137 age = math.floor(age_sec); |
136 sent = math.floor(bytes_tx/1024); |
138 sent = math.floor(bytes_tx/1024); |
137 }); |
139 }); |
138 end |
140 end |
139 mark_active(event.request); |
141 mark_active(event.request); |
|
142 event.response.headers.content_type = "application/json"; |
140 return "[\n "..table.concat(watchers, ",\n ").."\n]"; |
143 return "[\n "..table.concat(watchers, ",\n ").."\n]"; |
141 end |
144 end |
142 |
145 |
143 -- Called when a HTTP stream client closes |
146 -- Called when a HTTP stream client closes |
144 local function client_closed(request) |
147 local function client_closed(request) |