There are two methods that can be used to retrieve screenshots, table captures and animated GIF's from GrabzIt's API, both of which have their own advantages and disadvantages.
Also known as the callback method, this the recommended way to retrieve captures. However it does require the application being built to have a domain name or publicly available IP address. One example were this method could be used would be a web application.
As can be seen in the diagram the Asynchronous Method works by sending a call to GrabzIt and then waiting for a call being sent back to the application stating that the screenshot is ready. The advantage of using this method is that it requires fewer calls and allows other processes, such as a web requests to proceed uninterrupted.
An example of a asynchronous call is shown below for every server side language GrabzIt currently supports.
Remember that in order to call GrabzIt's API asynchronously you will need to implement this Node.js handler, however this should not be confused with the Node.js function callbacks. The callbacks discussed here are HTTP callbacks sent over the Internet!
var grabzit = require('grabzit');
var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
This method should only be used were it is not possible to use the Asynchronous Method. The Synchronous Method works by sending a call to GrabzIt to create the capture, then polling GrabzIt every few seconds until it's ready, as shown in the diagram.
Once ready it downloads the capture as usual. The disadvantage of this technique is that it forces the current process to wait until the capture is complete, which is why it is not appropriate for web applications. However the advantage is that the application does not need a domain name or IP address and so can be used from desktop applications.
An example of a synchronous call being made is shown below for every server side language GrabzIt currently supports.