-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Support RAW API, support read/write API, which means support calling the http API to modify configuration and reload. #319
Comments
API support writing is the foundation of many functionalities. API security (#470) is the foundation of support writing.
|
See #459 |
There are two options:
The first option, like nginx, has a significant impact on the current structure and is inconsistent. The second option would not have much impact, as it only provides configuration writing. I believe it is necessary to trigger DVR using an API, otherwise all streams of a channel would be recorded continuously, which is not suitable. Especially for applications with certain types of broadcasters or monitoring, it would be more effective to only record streams during certain time periods. Some can be differentiated based on vhost, where a vhost with DVR would be used for streams that need to be recorded, while a vhost without DVR would be used for those that do not need to be recorded. In reality, using an API to control DVR is primarily intended for situations where all streams may potentially need to be recorded, but not all of them actually need to be.
|
So if we choose to implement solution two, it will not disrupt the existing structure, ensure overall consistency, and not introduce new structures. It will be in line with HTTP RESTful API. I feel that this can be added.
|
The NGINX solution has two issues:
In other words, NGINX's dvr API implements this structure: In other words, it can actually be achieved by modifying the configuration and then reloading. For example, if you want to record a certain livestream flow, modify the configuration file:
Then, the reload will only record that flow. The API simply provides a way to modify the configuration file and then reload it; it is the same as directly modifying the configuration and reloading it through the console. This avoids the need for additional mechanisms in nginx to implement this functionality.
|
This also has a very important application, which can manage servers through the console. Adding channels and features can all be done directly through the interface, with many prompts and validations available.
|
I recommend reloading the affected vhost, following the principle of minimizing impact.
|
I will first add a signal, SIGUSR1, which can write the configuration to a file. SIGUSR2 is already used, it simulates SIGINT to allow the system to clean up and exit, and check for memory leaks.
Both can make SRS write the configuration to the configuration file.
|
An example of writing a configuration file:
|
I changed this feature to RAW API, which means reading from and writing to the API. It allows for easier communication with simpler vocabulary.
|
https://github.com/simple-rtmp-server/srs/wiki/v3_CN_HTTPApi#raw-update
|
The HTTP RAW API with global configuration has been completed. Demo address: http://ossrs.net/console/ng_index.html#/configs?host=ossrs.net&port=19851.
|
Adding, deleting, disabling, enabling, and modifying the name of Vhost have all been completed.
|
The RAW API is supported up to this point, more detailed API will need to be added later.+
|
#459 NGINX style DVR control module, can be done on the RAW API, and can be made more powerful. After the server restarts, it will remember the last API call, that is, the server will continue to remember which streams were recorded until canceled.
|
Compared to
|
Extending the language is too troublesome, it's not a good thing.
|
SIGUSR1 is used for log rotate in nginx, and has been corrected. Persistence log does not rely on signals, only through API support.
|
Writing CONFIG to a file is the best approach for a configuration file system. Another alternative is to not use a configuration file for dynamic configuration (only configuring the API server address in the configuration file) and obtain dynamic configurations through API.
|
If recording functionality is enabled in Docker, the Docker container exits as soon as the recording is started. Is there any workaround to bypass this mechanism and prevent the Docker container from exiting upon restarting SRS? Or do I have to give up Docker and choose another option?
|
Why does recording cause Docker to exit?
|
Is there still no API in cooperation with ingest within the vhost?
|
!!! Attention, the RAW API has been disabled after version 4.0, please refer to #2653 for background information.
!!! RAW API is removed from SRS 4.0, please see #2653
Other than the ability to reload, all other RAW API capabilities have been removed.
Provide an HTTP API to modify the configuration file and then reload the effective configuration.
https://github.com/winlinvip/simple-rtmp-server/issues/319
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: