mirror of
https://github.com/owntracks/recorder.git
synced 2024-11-15 18:08:28 -07:00
add topic to JSON directed at Websocket clients
This commit is contained in:
parent
f84947360c
commit
dc20cf3a7e
@ -564,6 +564,13 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
json_delete(geo);
|
||||
}
|
||||
|
||||
/*
|
||||
* I need a unique "key" in the Websocket clients to keep track
|
||||
* of which device is being updated; use topic.
|
||||
*/
|
||||
|
||||
json_append_member(wso, "topic", json_mkstring(m->topic));
|
||||
|
||||
if ((js = json_stringify(wso, NULL)) != NULL) {
|
||||
http_ws_push(ud->mgserver, js);
|
||||
free(js);
|
||||
|
@ -68,7 +68,7 @@ void get_geo(JsonNode *o, char *ghash)
|
||||
|
||||
|
||||
/*
|
||||
* Populate a JSON object (`node') keyed by directory name; each element points
|
||||
* Populate a JSON object (`obj') keyed by directory name; each element points
|
||||
* to a JSON array with a list of subdirectories on the first level.
|
||||
*
|
||||
* { "jpm": [ "5s", "nex4" ], "jjolie": [ "iphone5" ] }
|
||||
|
@ -28,11 +28,11 @@ function initialize() {
|
||||
|
||||
function map_marker(loc)
|
||||
{
|
||||
var id = loc.tid.replace(/\//g, '-');
|
||||
var id = loc.topic.replace(/\//g, '-');
|
||||
var d;
|
||||
|
||||
if (loc.addr && loc.tid) {
|
||||
d = loc.tid + " " + loc.addr;
|
||||
if (loc.addr && loc.topic) {
|
||||
d = loc.topic + " " + loc.addr;
|
||||
} else {
|
||||
d = 'unknown';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user