-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WEBRTC for communication between agents and browsers #14874
Conversation
Regarding the C++17 requirement, this functionally mandates GCC 7 or Clang 5 as a minimum compiler version. The only platform we officially support that cannot meet this requirement is CentOS 7, so the CentOS 7 CI jobs on this PR should be expected to fail even once we have libdatachannel vendored. CentOS 7 goes EOL upstream on 2024-06-30, and I would be more than happy to have an excuse to drop it early (dropping CentOS 7 support would let us do a lot of cleanup in the packaging code), but AIUI it’s still one of our more actively used platforms. That said, there is no reason we can’t just choose to not support this for native builds on CentOS 7. It needs to be optional at both compile time and runtime anyway for a number of reasons, so having a specific exception for one supported platform is not that onerous. A couple of other quick thoughts:
|
Hopefully libdatachannel has a C API. So, I rewrote the WEBRTC code in C, and now the dependency for C++17 is removed from Netdata. Still libdatachannel needs C++17, but if it can be compiled somehow on a target system, netdata will use it while happily working with C++11 for its own code. |
Regarding the CI failures:
|
No build is failing now. |
Guys, I would appreciate some testing on this PR. I have tried to simplify and unify query parsing and handling for our http APIs. I also significantly reduced the memory required per http request, from 220KiB to 18KiB (16KiB of which is the compression buffer). The same interface ( There is no point to test WebRTC at this point. I am interested mainly for possible issues at the web server and ACLK sides. Once this review is done, we can proceed and merge this (WebRTC is disabled by default - it is enabled only when compiled with internal checks). |
… cookie structures in web client
web/server/web_client.c
Outdated
buffer_flush(w->url_path_decoded); | ||
buffer_fast_strcat(w->url_path_decoded, "/", 1); | ||
buffer_strcat(w->url_path_decoded, url); | ||
return func(host, w, url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part will overwrite url
. Because of this the local agent dashboard cannot access children.
This results in 404
in access.log
eg
1591786 '[localhost]:49128' 'DATA' (sent/all = 126/173 bytes -27%, prep/sent/total = 0.09/0.03/0.12 ms) 404 '/host/rasp/api/v1/registry?action=hello'
webrtc_base.iceServersCount = i; | ||
internal_error(true, "WEBRTC: there are %d default ice servers: '%s'", webrtc_base.iceServersCount, buffer_tostring(wb)); | ||
|
||
char *servers = config_get(CONFIG_SECTION_WEBRTC, "ice servers", buffer_tostring(wb)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be in cloud.conf
or under aclk
so it is clear it is cloud related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is not aclk related. It is only webrtc related. The ICE servers are used for 2 purposes:
- STUN servers - users should be able to set their own if they want.
- TURN servers - users should be able to setup their own TURN servers if they want.
The default list should eventually be coming from the cloud though...
This is an experiment.
We explore the possibility of using WEBRTC (the technology that supports audio/video/chat conferencing calls), for improving the communication between agents and web browsers.
In general, WEBRTC should work like this:
In this PR, to create an easy playground for this technology, we bypassed the signalling server. So:
/api/v2/rtc_offer
at the agent sending its SDP and candidates. This is implemented (we had to improve the agent web server to support POST requests).So, what we have done so far:
condfigure.ac
to detect the availability of libdatachannel. When the system lacks this library, webrtc will be disabled at the agent.configure.ac
to use C++17. This was required by libdatachannel./api/v2/rtc_offer
to grab the SDP offer from the browser and send back to the browsers the agent's answer.web/rtc
directory with some basic code to setup WEBRTC communication.What remains to be done:
netdata.conf
.request with SDP offer:
browser --(https)--> cloud --(mqtt)--> agent
response with SDP answer:
agent --(mqtt)--> cloud --(https)--> browser
/api/v2/rtc_offer
endpoint from the agent./api/v2
endpoints.