afs-supervisor: Add ws-server option
[src/app-framework-binder.git] / src / afs-main.c
index 980a1bc..93e4932 100644 (file)
@@ -30,6 +30,7 @@
 #include "afb-hswitch.h"
 #include "afb-hreq.h"
 #include "afb-apiset.h"
+#include "afb-api-ws.h"
 #include "afb-session.h"
 
 #include "afs-supervisor.h"
@@ -149,6 +150,15 @@ static void start(int signum, void *arg)
                goto error;
        }
 
+       /* export the service if required */
+       if (main_config->ws_server) {
+               rc = afb_api_ws_add_server(main_config->ws_server, main_apiset);
+               if (rc < 0) {
+                       ERROR("Can't export (ws-server) api %s: %m", main_config->ws_server);
+                       goto error;
+               }
+       }
+
        /* start the services */
        if (afb_apiset_start_all_services(main_apiset, 1) < 0)
                goto error;