From c47182d60a6749f224f6e9411b33d2b05e3c8a6e Mon Sep 17 00:00:00 2001
From: Sami Spets <savasp@utu.fi>
Date: Thu, 10 Oct 2019 10:02:05 +0300
Subject: [PATCH] 'get_cfg' and 'update_cfg' added to node

---
 web-service/server/src/index.js | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/web-service/server/src/index.js b/web-service/server/src/index.js
index 27f00d762..2850542e0 100644
--- a/web-service/server/src/index.js
+++ b/web-service/server/src/index.js
@@ -457,14 +457,24 @@ app.ws('/', (ws, req) => {
 	});
 
 	/**
-	 * Gets config values for 
-	 */
-	//p.bind("get_cfg", )
+	 * Get configuration JSON values 
+	 */ 
+	p.bind("get_cfg", (cb, uri) => {
+		let peer = uri_data[uri].peer
+		if(peer){
+			peer.rpc("get_cfg", cb, uri)
+		}
+	})
 
 	/**
-	 * gets list of configurations from the C++
+	 * Update certain URIs values
 	 */
-	 //p.bind("update_cfg", )
+	 p.bind("update_cfg", (uri, json) => {
+		 let peer = uri_data[uri].peer
+		 if(peer){
+			 peer.send("update_cfg", uri, json)
+		 }
+	 })
 
 	// Register a new stream
 	p.bind("add_stream", (uri) => {
-- 
GitLab