Skip to end of metadata
Go to start of metadata

Let us take a look at operation of REST method through the example of the /publishStream method.

In the test interface of Streamer, a user sends a video stream to the WCS server.

 


Upon clicking the Start button, the interface invokes the stream.publish() function that begins broadcasting.

Here is a step-by-step diagram of publishing and invoking the publishStream REST method:

  1. stream.publish() is invoked on the client side
  2. WCS queries the local web server at http://localhost:8081/apps/publishStream
  3. WCS receives 200 OK response from the local server
  4. WCS sends the StreamStatusEvent event to the client, status = PUBLISHING

 


The final result is the PUBLISHING status displayed on the web page:

 


Invocation of the /publishStream method (step 2) looks as follows when the HTTP protocol is analyzed in Wireshark:

Request

Response

POST /EchoApp/publishStream HTTP/1.1
Accept: application/json, application/*+json
Content-Type: application/json;charset=UTF-8
User-Agent: Java/1.8.0_45
Host: localhost:8081
Connection: keep-alive
Content-Length: 3622

{  
   "nodeId":"H4gfHeULtX6ddGGUWwZxhUNyqZHUFH8j@192.168.1.59",
   "appKey":"defaultApp",
   "sessionId":"/192.168.1.38:52791/192.168.1.59:8443",
   "mediaSessionId":"87c5ff20-fb59-11e6-812c-1b28ccb49323",
   "name":"84cac22c",
   "published":true,
   "hasVideo":true,
   "hasAudio":true,
   "status":"PENDING",
   "record":false,
   "width":0,
   "height":0,
   "bitrate":0,
   "quality":0,
   "mediaProvider":"WebRTC"
}
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Sat, 25 Feb 2017 05:51:11 GMT



{  
   "nodeId":"H4gfHeULtX6ddGGUWwZxhUNyqZHUFH8j@192.168.1.59",
   "appKey":"defaultApp",
   "sessionId":"/192.168.1.38:52791/192.168.1.59:8443",
   "mediaSessionId":"87c5ff20-fb59-11e6-812c-1b28ccb49323",
   "name":"84cac22c",
   "published":true,
   "hasVideo":true,
   "hasAudio":true,
   "status":"PENDING",
   "record":false,
   "width":0,
   "height":0,
   "bitrate":0,
   "quality":0,
   "mediaProvider":"WebRTC"
}