GET /cn/:cn/data_stream/sessionId/:sessionId - Use persistent web socket to all your devices

Resumes to the WebSocket session which has already been created. If there are undelivered messages at Kaltiot Smart IoT, those will be delivered once websocket connection has been established. Data comes as array of JSON objects.

Request Parameters

ParameterDataTypeDescription
cnstringCommon Name, Identifier which is common for all your device
sessionIdString

SessionId which gives ability to join existing web socket session and get all offline messages since websocket session has been created. You can get sessionId parameter for doing POST /cn/:cn/data_stream

Example client request of establishing websocket connection

GET /cn/example_cn/data_stream/sessionId/123?ApiKey=example_apikey HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Origin: http://127.0.0.1:8080
Sec-WebSocket-Key: KzJwcJDCSruzORfG59fR9g==
Sec-WebSocket-Version: 13
Host: 127.0.0.1:8080
Accept: */*
User-Agent: AHC/1.0
Content-Length: 0

Example server response for establishing websocket connection

HTTP/1.1 101 Switching Protocols

Upgrade: websocket

Connection: Upgrade

Sec-WebSocket-Accept: yTLy8kTvOiexc2/CyyJqLGJbd7I=

Response Status Codes

Server will return 101 http code if WebSocket connection was accepted by server

For error cases see: Error Status Codes

Response Data Parameters

ParameterDatatypeDescription
ridstringUnique identifier to your device
timestampnumbertime in milliseconds from Jan 1970 UTC
payload_typestringenumeration data type for the payload. Possible values: STRING, INT, BINARY
payloaddepends on payload_type parameterThis is data object which IoT devices publishes. Can be everything as long as it comforts JSON standard

Example response

[{"rid":"example_rid","timestamp":"1424427183946","payload_type": "INT",payload: 1}]