Versions Compared

Key

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

...

If we want to listen messages real time, we have two optionts. First option is to create persistene web socket connection and then open connection to it. Benefit for this is that if you lose your web socket connection, you wont lose the messages what that have been sent when web socket connection was down. Instead, but you will receive all the messages once you re-establish the web socket connection. Second option is to just open web socket connection, but in this case you will lose the message , if your web socket connection goes down. Now we go with first option where we first create persistent session and then using session id we open web socket connection to it.

...

Take the session_id parameter from the response and use that in next curl command to open web socket connection.

No Format
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: restapi.torqhub.io" -H "Origin:https://restapi.torqhub.io" "https://restapi.torqhub.io/rids/<YOUR RID GOES HERE>/data_stream/sessionId/<YOUR SESSION ID GOES HERE>?ApiKey=<YOUR API KEY GOES HERE>"

[{"rid":"0b731092-ca78-11e5-a38b","time":1455007843000,"id":"85EC4B89-33CA-4E62-A0D1-0454B9C3FAF3","payload_type":"STRING","payload":"65.010735,25.468914,0,0,0,0,0,1,0.0,0.0"}]▒[{"rid":"0b731092-ca78-11e5-a38b","time":1455007843000,"id":"85EC4B89-33CA-4E62-A0D1-0454B9C3FAF3","payload_type":"STRING","payload":"65.010735,25.468914,0,0,0,0,0,-1,0.0,0.0"}] 

...