Node.js Async

In my previous post I discussed how asynchronous (with callbacks) nature of Node.js is useful to develop non-blocking server side implementations. Let's now see how async functions are developed with an example. Async functions are typically developed with a single callback with result arguments and an optional error. Here's an example code: https://gist.github.com/4553831 Now if … Continue reading Node.js Async

Tornado – Blocking & Non-Blocking HTTP Client

Tornado provides tornado.httpclient that works as httpclient and can send blocking and non-blocking (async) http requests. tornado.httpclient.HTTPClient 1. HTTPClient: This tornado client is typically used for testing web servers or simply making a HTTP request and receiving the response. An example implementation below https://gist.github.com/3394444 tornado.httpclient.AsyncHTTPClient 2. AsyncHTTPClient: httpclient.AsyncHTTPClient()  creates an instance of the class and … Continue reading Tornado – Blocking & Non-Blocking HTTP Client

Tornado – Asynchronous Requests

Tornado is a non-blocking I/O web server. In Tornado, when the request handler serves the request made by the client, the request is closed by itself. Python decorator @tornado.web.asynchronous can be used to override the default behavior (of automatically finishing the request) and keep the request open. So, its the duty of the server developer … Continue reading Tornado – Asynchronous Requests