Contents

About the push service.

The Server-Eye push service is a HTTPS long polling web service. This means you establish a connection that waits for a result for a long time, returns with response data or without, and you have to re-establish the connection again.

The push services' second purpose is to track if your container is still alive. Every time you request the push service a heartbeat is sent, so that the alerting component of Server-Eye knows, that your container is still running and connected. If your container is not able to connect to the push service for longer than your containers' specified timeout an alert is triggered.

What is the common workflow?

  1. Wait

    Call /push/{containerId} and wait for the response to return. This takes up to 45 seconds. If there is data, it will look something like this:

    {
        success : true,
        message : '...', // not interesting to you
        data : {
            rootContainerId : 'CONTAINERID',
            containerId : 'CONTAINERID',
            senderId : 'CONTAINERID',
            messageId : 'SOME-MESSAGE-ID',
            ...
        }
    }
                                

    rootContainerId, containerId and senderId will have the same ID. The different IDs are required for the Server-Eye client, because OCC Connectors, Sensorhubs and Sensors can receive and trigger remote calls. In your case only your script can receive remote calls.

    messageId is a unique ID for this message and data. Keep it!

  2. Repeat step 1 forever!

  3. Acknowledge

    Acknowledge that you received the data. This is important, because the OCC needs to known if you received anything and if you will process it.
    If processing of the data takes more than 20 seconds you'll have to call /push/{containerId}/ack/{messageId} every 15 seconds.

  4. Tell your result

    Tell the OCC what you did and return some data. Even if you didn't generate any data return if processing was a success or not

    POST /push/{containerId}/result/{messageId}
            success true | false
            message 'did great'
            data { my : 'data' }
                                
  5. Sign off

    Is your container about to shutdown? Please sign off using /push/{containerId}/signoff.

Why should I sign off?

If you don't sign off there is a timespan that a user can click on a remote button, but your service won't answer, because it is no longer there.

Please sing off, so the OCC and the user know emediately that your service is not active at the moment!