| PST SDK 6.0.0.0-272350a

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 a new connection is established, if camera images are enabled, frames are served with a text/event-stream Content-Type, that follows the SSE format. Typically, a frame consist of 2 images, each of them contained in a "data:" line. This pair of images is terminated by a second carriage return.

Note
  The server does not allow to have more than 2 image 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 does not 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 represents 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 represents 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"} | There are 2 image streams open already. cf. CloseImageStream
500 | {"message":"TrackerException: <...>"} | An other type of internal error