...
By default, all REST queries follow to the local address: http://localhost:90918081/apps/EchoApp
The invocations of REST methods look as follows then:
- http://localhost:90918081/apps/EchoApp/connect
- http://localhost:90918081/apps/EchoApp/playStream
- http://localhost:90918081/apps/EchoApp/publishStream
and so on.
This happens because the appKey=defaultApp parameter is sent when connection to the WCS server, and the default app for this key is this URL: http://localhost:90918081/apps/EchoApp
To change these settings, enter to the command line interface of the WCS server core via SSH:
Code Block | ||||
---|---|---|---|---|
| ||||
ssh -p 2000 admin@localhostp 2001 admin@localhost |
Use the password you have specified when installing WCS.
...
Code Block | ||||
---|---|---|---|---|
| ||||
>% |
You can execute the show apps command to see the current applications:
Code Block | ||||
---|---|---|---|---|
| ||||
>show apps%show apps |
Or enter the help command to display the list of available commands:
Code Block | ||||
---|---|---|---|---|
| ||||
>help%help |
Then, we create our own REST URL. It is created using the add app command.
Suppose, we allocated the following address on the web server for REST methods:
- http://mywebserver.com/rest/connect
- http://mywebserver.com/rest/playStream
- http://mywebserver.com/rest/publishStream
and so on.
So we configure this as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
>add app myApp myAppKey %add app myApp myAppKey "http://mywebserver.com/rest" |
This command creates a new URL, http://mywebserver.com/rest, and assigns this URL for usage if a client sent the appKey=’myAppKey’ during connection.
...
Flashphoner.createSession({appKey:’myAppKey’...}); | http://mywebserver.com/rest/connect |
Adding and deleting REST methods
By default, server application is created without any REST methods are not methods, then methods should be added to the newly configured URL. To add the REST methods, use the following CLI commandsapplication with the following command (connect for example):
Code Block | ||||
---|---|---|---|---|
| ||||
>add app%add app-rest-method -a myApp |
This will add all REST methods to the myApp application.
If you add all REST methods at once, make sure your HTTP URLs: http://mywebserver.com/rest/connect http://mywebserver.com/rest/playStream and others respond with 200 OK and return the data they have received.
...
method MyAppKey connect |
If backend server will handle all possible REST methods, then all methods should be added with the following command:
Code Block | ||||
---|---|---|---|---|
| ||||
>add app%add app-rest-method myApp connect |
In this case only one REST method is added: connect.
To delete REST methods, use the following commands:
Code Block | ||||
---|---|---|---|---|
| ||||
remove app-rest-method -a myApp
remove app-rest-method myApp connect |
...
method -a MyAppKey |