From f23732945b392a87ee1207fd19b63ebf02d4c358 Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 30 Dec 2018 09:04:00 +0100 Subject: [PATCH] [websocket] Support "database" notifications --- src/websocket.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/websocket.c b/src/websocket.c index 9fd17efd..6cb41a2b 100644 --- a/src/websocket.c +++ b/src/websocket.c @@ -129,6 +129,10 @@ process_notify_request(struct ws_session_data_notify *session_data, void *in, si { session_data->events |= LISTENER_UPDATE; } + else if (0 == strcmp(event_type, "database")) + { + session_data->events |= LISTENER_DATABASE; + } else if (0 == strcmp(event_type, "pairing")) { session_data->events |= LISTENER_PAIRING; @@ -193,6 +197,10 @@ send_notify_reply(short events, struct lws* wsi) { json_object_array_add(notify, json_object_new_string("update")); } + if (events & LISTENER_DATABASE) + { + json_object_array_add(notify, json_object_new_string("database")); + } if (events & LISTENER_PAIRING) { json_object_array_add(notify, json_object_new_string("pairing")); @@ -306,7 +314,7 @@ static struct lws_protocols protocols[] = static void * websocket(void *arg) { - listener_add(listener_cb, LISTENER_UPDATE | LISTENER_PAIRING | LISTENER_SPOTIFY | LISTENER_LASTFM | LISTENER_SPEAKER + listener_add(listener_cb, LISTENER_UPDATE | LISTENER_DATABASE | LISTENER_PAIRING | LISTENER_SPOTIFY | LISTENER_LASTFM | LISTENER_SPEAKER | LISTENER_PLAYER | LISTENER_OPTIONS | LISTENER_VOLUME | LISTENER_QUEUE); while(!ws_exit)