PST SDK  5.0.1.0-acae3ae
StartRawImageDataStream

Retrieves real time camera images (if enabled) by subscribing to an event stream.

The PST Rest server implements a Server-Send Events (SSEs) communication channel. When an new connection is established, if camera images are enabled, frames are served with a text/event-stream Content-Type, that follows the SSE format. Each images is contained in a new "data:" line. Typically, a frame consist of 2 images, each of them contained in a "data:" line. This pair of images is terminated by a second cariage return.

Note
The server doesn't allow to have more than 2 images streams open at the same time. It is possible to close all currently opened image streams using PSTapi/CloseImageStream or PSTapi/CloseStreams. If a client closes the connection or doesn't read the data fast enough, the server will automatically end the connection.
More detailed information on Server Sent Events and the event-stream protocol can be found at https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format
Endpoint
  
  GET /PSTapi/StartRawImageDataStream  HTTP/1.1
  Host: address:port
 
Get Request example
 
  http://localhost:7278/PSTapi/StartRawImageDataStream
 
Response

Open a Server-Send Events (SSEs) stream, with a text/event-stream Content-Type. Each message represent a new capture that follows the SSE format. A message has several "data:" lines representing each camera and is terminated by a carriage return character \n. Each "data:" line represent a base64 encoded jpeg camera image.

SSE Data Object
Key Value Type Description
data base64 string a base 64 string representing a Jpeg image
Example
 
  data: <a base64 string representing a Jpeg image, the left/right camera, 1st frame>
  data: <a base64 string representing a Jpeg image, the left/right camera, 1st frame>
data: <a base64 string representing a Jpeg image, the left/right camera, 2nd frame> data: <a base64 string representing a Jpeg image, the left/right camera, 2nd frame>
data: <a base64 string representing a Jpeg image, the left/right camera, 3rd frame> data: <a base64 string representing a Jpeg image, the left/right camera, 3rd frame>
...
Verification table
Status Code Content Example Meaning
200 json event stream "data:" stream of "data" objects containing the images
429 {"message":"TOO_MANY_IMAGES_STREAM_ALREADY_OPENED"} Their is already 2 image stream open. cf. CloseImageStream
500 {"message":"TrackerException: <...>"} an other type of internal error