### Windows: Install CherryPy Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/README.md Unzip CherryPy-3.2.2.zip and install with `python setup.py install --user`. ```bash cd CherryPy-3.2.2 python setup.py install --user ``` -------------------------------- ### MacPro: Install pip for Python Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/README.md Install pip via easy_install when pip is not present, or download pip 10.0.1 from a specific URL and install via setup.py. ```bash pip --version 2>/dev/null || sudo easy_install pip ``` ```bash url='https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz#sha256=f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68' && pip --version 2>/dev/null || (wget $url -O pip-10.0.1.tar.gz tar xf pip-10.0.1.tar.gz && cd pip-10.0.1 && sudo python setup.py install) ``` -------------------------------- ### MacPro: Setup Python Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/README.md Install CherryPy 3.2.2 from the local zip. Use after installing pip. ```bash (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) ``` -------------------------------- ### CentOS6: Install pip and CherryPy Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/README.md Install pip if missing, then install CherryPy 3.2.2 from the local zip. Use on CentOS6 before starting the server. ```bash (pip --version 2>/dev/null || sudo yum install -y python-pip) && (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) ``` ```bash (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) ``` -------------------------------- ### Setup Python on CentOS6 Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/python/README.md Install pip if missing, then extract and install CherryPy-3.2.2. This step is required before starting the AppServer on CentOS6. ```bash (pip --version 2>/dev/null || sudo yum install -y python-pip) && (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) ``` -------------------------------- ### Windows: Install pycryptodome Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/README.md Download pycryptodome from the specified location, then unzip and install with `python setup.py install --user`. The wildcard `pycryptodome-*` matches the extracted directory. ```bash cd pycryptodome-* python setup.py install --user ``` -------------------------------- ### Start AppServer on Windows Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/python/README.md Command to launch server.py using python with the specified listen port, AppID, AppKey, and GSLB URL. Replace the placeholder credentials with your own information. ```bash python server.py --listen=8080 --appid=xxxxxxxx \ --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ --gslb=https://rgslb.rtc.aliyuncs.com ``` -------------------------------- ### Start AppServer on CentOS6 Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/python/README.md Command to launch server.py with the specified listen port, AppID, AppKey, and GSLB URL. Replace the placeholder credentials with your own information. ```bash ./server.py --listen=8080 --appid=xxxxxxxx \ --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ --gslb=https://rgslb.rtc.aliyuncs.com ``` -------------------------------- ### Install pip for Python on MacPro Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/python/README.md Install pip via easy_install if it is not already present, which is a prerequisite for setting up the server environment on MacPro. ```bash pip --version 2>/dev/null || sudo easy_install pip ``` -------------------------------- ### Install pip via tarball on MacPro Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/python/README.md Downloads a specific pip 10.0.1 tarball and installs it if pip is not already available. This is an alternative to the easy_install method. ```bash url='https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz#sha256=f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68' && pip --version 2>/dev/null || (wget $url -O pip-10.0.1.tar.gz tar xf pip-10.0.1.tar.gz && cd pip-10.0.1 && sudo python setup.py install) ``` -------------------------------- ### CentOS6: Start AppServer Verify Server Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/README.md Run the server listening on port 9000 to begin verification. Command is ./server.py --listen=9000. ```bash ./server.py --listen=9000 ``` -------------------------------- ### Generate Node.js AppServer config and start server Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/nodejs/README.md Clone the project, generate a config.js file with listen port, appId, appKey, and gslb values, then run the server. Replace the placeholder credentials with actual values. Verify the server with the VerifyServer tool. ```bash npm install && echo "module.exports = {" > config.js && echo " listen: 8080," >> config.js && echo " appId: 'xxxxxxxx'," >> config.js && echo " appKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'," >> config.js && echo " gslb: 'https://rgslb.rtc.aliyuncs.com'" >> config.js && echo "};" >> config.js && node index.js ``` -------------------------------- ### AppID and AppKey example Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/java/README.md Placeholder values for AppID and AppKey that must be replaced with your own credentials from the Aliyun RTC console. ```text AppID: xxxxxxxx AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` -------------------------------- ### Run Ruby AppServer Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/ruby/README.md Starts the AppServer with the provided appid, appkey, gslb URL, and listen port. Replace the placeholders with your values. ```bash ruby server.rb --listen=8080 --appid=xxxxxxxx \ --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --gslb=https://rgslb.rtc.aliyuncs.com ``` -------------------------------- ### Command-line arguments Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/java/README.md Command-line arguments to run the AppServer, replacing the placeholders with your actual App ID, App Key, and optionally the GSLB URL. ```text --listen=8080 --appid=xxxxxxxx --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --gslb=https://rgslb.rtc.aliyuncs.com ``` -------------------------------- ### Install go.uuid with go get Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/vendor/github.com/satori/go.uuid/README.md Use the go command to install the package. Requires Go >= 1.2. ```shell $ go get github.com/satori/go.uuid ``` -------------------------------- ### Install sinatra gem Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/ruby/README.md Install the sinatra gem using Ruby's gem package manager. This is required before running the server. ```bash gem install sinatra ``` -------------------------------- ### Run AppServer Command Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/csharp/README.md Command to run the C# AppServer with required arguments: --listen, --appid, --appkey, and --gslb. ```plain text --listen=8080 --appid=xxxxxxxx --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --gslb=https://rgslb.rtc.aliyuncs.com ``` -------------------------------- ### Commands to create Config.php with environment settings Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/php/README.md Shell commands that generate a Config.php file containing the AppServer port, app ID, app key, and gslb endpoint. Replace placeholders with your actual values. ```bash echo " Config.php echo "\$listen = 8080;" >> Config.php echo "\$app_id = 'xxxxxxxx'; " >> Config.php echo "\$app_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; " >> Config.php echo "\$gslb = 'https://rgslb.rtc.aliyuncs.com'; " >> Config.php echo "?>" >> Config.php ``` -------------------------------- ### Create and parse UUIDs in Go Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/vendor/github.com/satori/go.uuid/README.md Example program using UUID Version 4 creation with uuid.NewV4() and parsing from string input with uuid.FromString(). Shows potential error handling and output formatting. ```go package main import ( "fmt" "github.com/satori/go.uuid" ) func main() { // Creating UUID Version 4 u1 := uuid.NewV4() fmt.Printf("UUIDv4: %s\n", u1) // Parsing UUID from string input u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") if err != nil { fmt.Printf("Something gone wrong: %s", err) } fmt.Printf("Successfully parsed: %s", u2) } ``` -------------------------------- ### Run Golang AppServer with CLI arguments Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/README.md Command to run the AppServer with the required listen port, appid, appkey, and gslb parameters. ```bash go run main.go --listen=8080 --appid=xxxxxxxx \ --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --gslb=https://rgslb.rtc.aliyuncs.com ``` -------------------------------- ### Build gmoryx.aar with gomobile bind Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/README.md Builds the gmoryx.aar library for Android using the gomobile bind command. Requires setting up the Go mobile environment as described in the GOMOBILE section. Execute from the gmoryx directory within the Go workspace. ```bash cd $GOPATH/src/github.com/ossrs/go-oryx-lib/gmoryx && mkdir -p AndroidHTTPServer/app/libs && gomobile bind -target=android -o AndroidHTTPServer/app/libs/gmoryx.aar ``` -------------------------------- ### Adding context with errors.Wrap Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/vendor/github.com/ossrs/go-oryx-lib/errors/README.md Wrap an error to add context while preserving the original error value. ```go _, err := ioutil.ReadAll(r) if err != nil { return errors.Wrap(err, "read failed") } ``` -------------------------------- ### Traditional Go error handling idiom Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/vendor/github.com/ossrs/go-oryx-lib/errors/README.md Used as the basic Go error check and return pattern. ```go if err != nil { return err } ``` -------------------------------- ### Retrieving the cause with errors.Cause and type switch Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/vendor/github.com/ossrs/go-oryx-lib/errors/README.md Recursively retrieve the topmost error that does not implement causer, then handle specific types. ```go switch err := errors.Cause(err).(type) { case *MyError: // handle specifically default: // unknown error } ``` -------------------------------- ### Defining the causer interface for errors.Cause Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/golang/vendor/github.com/ossrs/go-oryx-lib/errors/README.md Any error value implementing this interface can be inspected by errors.Cause. ```go type causer interface { Cause() error } ``` -------------------------------- ### Token Verification Algorithm: sha256 hash of concatenated parameters Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/html/views/token-check.html Shows the token generation algorithm for verification. The token is a SHA-256 hash of concatenated appID, appKey, channelID, userID, nonce, and timestamp (as a string). Displays the input values and the computed expected hash for validation. ```plaintext token = sha256( appID + appKey + channelID + userID + nonce + str(timestamp) ) appID: {{input.appid}} appKey: {{input.appKey}} channelID: {{input.channelID}} userID: {{input.userid}} nonce: {{input.nonce}} timestamp: {{input.timestamp}} token: {{input.token}} expect: sha256({{input.appid}}{{input.appKey}}{{input.channelID}}{{input.userid}}{{input.nonce}}{{input.timestamp}}) = {{control.expect}} ``` -------------------------------- ### AngularJS controller for complex alert with close/closed events Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/html/js/bravo_alert/demo/demo_alert_complex.html Defines callbacks for the alert close and closed events, and actions for the alert's buttons. Sets 'alert_show_complex' to true to initially show the alert. ```javascript angular.module('userApp', ['bravoUiAlert']) .controller('UserAlertController', ['$scope', function ($scope) { $scope.alert_complex_close = function () { $scope.alert_show_complex = false; console.log("alert_complex close"); alert("alert_complex close"); }; $scope.alert_complex_closed = function () { console.log("alert_complex closed"); alert("alert_complex closed"); }; $scope.take_this_action = function () { console.log("take this action"); alert("take this action, do something..."); }; $scope.or_do_this_action = function () { console.log("or do this action"); alert("or do this action, do something..."); }; $scope.alert_show_complex = true; }]); ``` -------------------------------- ### AngularJS Controller for Bravo Alert Control Source: https://github.com/aliyunvideo/alirtcappserver/blob/master/verify/html/js/bravo_alert/demo/demo_alert_senior.html Controller for the bravo alert senior demo, managing alert visibility and handling close and closed events. The alert-show attribute binds to the controller variable, and the controller provides functions to show/close the alert with console logs and native alerts. ```javascript angular.module('userApp', ['bravoUiAlert']) .controller('UserAlertController', ['$scope', function ($scope) { $scope.alert_complex_close = function () { $scope.alert_show_senior = false; console.log("alert_complex close"); alert("alert_complex close"); }; $scope.alert_complex_closed = function () { console.log("alert_complex closed"); alert("alert_complex closed"); }; $scope.alert_complex_show = function () { $scope.alert_show_senior = true; }; $scope.alert_show_senior = true; }]); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.