JSON API Question

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

JSON API Question

Post by Nakia » Tue Apr 23, 2013 12:52 am

Hi,

I am working on building an interface to interact with an API but part of the documentation (and rather how LC would implement it) has me confused.

The API has a "monitor" feature that allows a long connection to the API to monitor real time events.
The thing I don't get is how it returns its values, will it send an update when something changes or do I have to keep looping through the request in a repeat loop to fetch the results?

Doco below:
4.8.4 Data Share Monitor Syntax
http://host:port/<root_path>/<protocol_id>/<service_id>/monitor? timeoutSeconds=5,ClientId=#

A MONITOR request will open a long connection through which real‐time events may be reported. The ClientId is
mandatory and must be a unique identifier for the client application. Client applications may generate their own
ClientId (a universal unique identifier string) or use the ClientId service. The server will maintain a queue for each
unique client and will make sure that no messages are lost over short connection outages. The server may discard
some older messages in the event of a long connection outage. The timeoutSeconds parameter will determine how
long the long connection is to remain open. On expiry of the timeout, the client will be required to reconnect to the
server using its associated ClientId. The response should include a flag indicating if any data was lost (e.g. some
older events were discarded by the server).

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: JSON API Question

Post by Nakia » Thu Apr 25, 2013 11:02 pm

Any thoughts on this one ?

It reads to me as though it will continue to send me data but in terms of implementing it LC would I just loop through the request ? Noting that each request return should contain any events that have occurred between requests (based upon queue/client ID)

Post Reply