Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Web-server will invoke REST-method /OnDataEvent - steop step 2. As a result, client will receive status SESSION_STATUS.SEND_DATA_STATUS ACCEPTED - step 4.

...

Web-server will invoke REST-method /OnDataEvent - steop step 2. As a result, client will receive status SESSION_STATUS.SEND_DATA_STATUS FAILED - step 4.

 


 Пример Example:

2

3

Code Block
languagejs
themeRDark
POST /rest/my_api/OnDataEvent HTTP/1.1
Accept: application/json, application/*+json
Content-Type: application/json;charset=UTF-8
User-Agent: Java/1.8.0_111
Host: 192.168.1.101
Connection: keep-alive
Content-Length: 218

{
    "nodeId":"Hw47CFMBEchVOpBMDr29IxjudnJ1sjOY@192.168.1.101",
    "appKey":"defaultApp",
    "sessionId":"/192.168.1.102:25789/192.168.1.101:8443",
    "operationId":"d0149310-fdeb-11e6-9b58-9509528e5d66",
    "payload":{
        "message":"hello"
    }
}
Code Block
languagejs
themeRDark
HTTP/1.1 403 Forbidden
Date: Tue, 28 Feb 2017 19:26:30 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

...

There is a way to send a direct message to a connected client client with REST API query http://host:8081/rest-api/RESTCallbackdata/sendDatasend

To do this, pass the following JSON object

Code Block
languagejs
themeRDark
{  
   "nodeId":"",
   "sessionId":"/192.168.1.102:25789/192.168.1.101:8443",
   "operationId":"",
   "payload":{  
      "test":"test"
   }
}

Where sessionId is connected client session identifier that is received on backend while REST hook /connect handling.

In this case, the connected client receives the custom object where you can put any data, for example {"test":"test"} as shown above.

...