- int fd, rc;
-
- /* check for systemd socket */
- if (0 == strncmp(path, "sd:", 3))
- fd = sd_fds_for(path + 3);
- else {
- /* check for unix socket */
- if (0 == strncmp(path, "unix:", 5))
- /* unix socket */
- fd = api_ws_socket_unix(path + 5, server);
- else
- /* inet socket */
- fd = api_ws_socket_inet(path, server);
-
- if (fd >= 0 && server) {
- rc = 1;
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &rc, sizeof rc);
- rc = listen(fd, 5);
- }
- }
- /* configure the socket */
- if (fd >= 0) {
- fcntl(fd, F_SETFD, FD_CLOEXEC);
- fcntl(fd, F_SETFL, O_NONBLOCK);
- }
- return fd;
+ return afb_api_ws_add_client(uri, declare_set, call_set, 1);