Skip to main content

Get Messages - Long Poll

"Long Poll" versions of Data/GetMessageRecords and Data/GetMessageRecordsForThing are also exposed.

See Receiving Messages (MO) for basic (non-long-poll) usage.

These endpoints are designed for quickly and reliably acquiring new Messages with the lowest amount of latency.

Mirroring the basic endpoints, two Long Poll endpoints exist for acquiring Messages for Account or Thing.

Long Poll Workflow

Follow this procedure for utilising the long poll endpoints...

  1. Initial Request - no since parameter is submitted as last message is not known
  2. Server returns most recent Message Record
  3. Client makes follow-on request, this time supplying above since value
  4. Server will immediately return any new Messages since since (if available, maximum 200)
  5. If no new Message, service will wait up to maxPollTime for new Messages
  6. Service will return as soon as a new Message is received
  7. If no new Messages after maxPollTime - Service will return an empty response
  8. Client Repeat - Goto 3

Get Messages (By Account) - Long Poll

  • since - the last Message Record Identifier (blank, if unknown)
  • maxPollTime - the maximum amount of time (seconds) to wait for new Messages

Initial Request

Data/GetMessageRecordsLongPoll
{
"messageRecords": [
{
"snippet": "0ACA010A2437326237666437642D313732352D346366632D623436382D3835646136623939326463341AA1010A39747970652E676F6F676C65617069732E636F6D2F726F73657474612E6365656661782E436565666178556E736F6C6963697465644576656E7412640A0F0A070809100A18E70F12040812180612510803120F",
"at": "2023-10-09T18:00:13",
"size": 205,
"id": "mRbxMoAQkLdKJBkxxognqYZpaOgjPwly",
"type": "IMT",
"thing": "dYrLZzemNQwPagBmmxByOqXbvMVjAoDG",
"direction": "MO",
"pulseRecord": "YrLZzemNQwPagWmKVLOByOqXbvMVjAoD"
}
]
}

**Endpoint: ** Data/GetMessageRecordsLongPoll


Data/GetMessageRecordsLongPoll?since=mRbxMoAQkLdKJBkxxognqYZpaOgjPwly

Subsequent - No Records

{
"messageRecords": []
}

Get Messages (By Thing) - Long Poll

  • thing - Cloudloop Thing Identifier (e.g. dYrLZzemNQwPagBmmxByOqXbvMVjAoDG)
  • since - the last Message Record Identifier (blank, if unknown)
  • maxPollTime - the maximum amount of time (seconds) to wait for new Messages

Initial Request

Data/GetMessageRecordsLongPoll?thing=XXX
{
"messageRecords": [
{
"snippet": "0ACA010A2437326237666437642D313732352D346366632D623436382D3835646136623939326463341AA1010A39747970652E676F6F676C65617069732E636F6D2F726F73657474612E6365656661782E436565666178556E736F6C6963697465644576656E7412640A0F0A070809100A18E70F12040812180612510803120F",
"at": "2023-10-09T18:00:13",
"size": 205,
"id": "mRbxMoAQkLdKJBkxxognqYZpaOgjPwly",
"type": "IMT",
"thing": "dYrLZzemNQwPagBmmxByOqXbvMVjAoDG",
"direction": "MO",
"pulseRecord": "YrLZzemNQwPagWmKVLOByOqXbvMVjAoD"
}
]
}

**Endpoint: ** Data/GetMessageRecordsForThingLongPoll


Subsequent interaction

Data/GetMessageRecordsLongPoll?thing=XXX&since=mRbxMoAQkLdKJBkxxognqYZpaOgjPwly

Subsequent - No Records

{
"messageRecords": []
}

Subsequent - New Records

{
"messageRecords": [
{
"snippet": "0ACE010A2464666462623338622D356564622D343032392D613335662D3932643061376134356237371AA5010A39747970652E676F6F676C65617069732E636F6D2F726F73657474612E6365656661782E436565666178556E736F6C6963697465644576656E7412680A110A070809100A18E70F12060812100A180812530803",
"at": "2023-10-09T18:11:23",
"size": 209,
"id": "KXeNzdgDqZwrQBbppZmWxMLlmoGpaOAR",
"type": "IMT",
"thing": "dYrLZzemNQwPagBmmxByOqXbvMVjAoDG",
"direction": "MO",
"pulseRecord": "OVdRorbmlwqkNWpzvdXBJYPZvxaXpzjL"
}
]
}