there’s been a buzz everywhere especially in the JavaScript corner which my always chilling with some peeps,anyway its about Node.Js now u ask what’s Node.Js ? lets say we are all familiar with the Apache the HTTP Server that the whole world uses except for the Evil guys (“Microsoft”) , well due to my limited knowledge of Apache, from the basic i know it handles all request from the Client and for each request starts a new thread to handle the process,infact most people don’t know that PHP doesn’t handle your request apache handles that and calls PHP which reads from start line to end line,in a blocking manner now by blocking manner,imagine we write a code to retrieve the no of hookers that live around your hood and tag them on Google Maps on PHP,however for some reason the no of hookers in ur hood multiplied maybe because your hood is a thriving one,the script with halt and wait till the operation finishes till it resume processing the next line which is why people always cache datasources. however in Node.JS its entirely different Node.JS uses Asynchronous pattern meaning,rather than waiting for the no of hookers in your hood it moves on to deal with other issues and which is referend to as “Event_Driven”, a callback is provided is alert that the process has been finished and it retrieves the value. if you have ever tried coding for the Blackberry Platform in Java you will rememeber when thet tell you never to run a long code in the Main Activity but to use a thread which is hy most BB Apps hang when loading data. Node.JS also uses a single thread to handle all concurrent connections meaning if i requested for a document and you requested for another,its the same thread serving both of us,but because Node.JS uses the V8 Engine in Google Chrome which is said to be the fastest it handle the connection well.
Now why am i hying Node.Js ,well have you ever wanted to create a Socket Programming type of app,when the server pushes the data to client rather than client request for it,well with Node.JS you can do that,and best part of all is that if u write javaScript then u can write Node.Js to some point as it requires advanced knowledge of asynchronous coding. if you have ever done this in JS
[code]
var No_of_hookers_in_the_hood=AjaxRequest.call("/HookersDB/",function(value_from_HookerDB){
var value=JSON.parse(value_from_HookerDB); //where HookerDb is a JSON Literal
foreach(var i in value) //that value is now an object
{
alert(i);
}
});
[/code] then u aleady understand what asynchronous coding is a function that runs in the nearby function with a callback,however shared hosting won’t allow you to install Node.JS on their server unless VPS or u’re rich enough to get a dedicated server, you can create mad app that deal with real time data computations like Online Ranking or Live Chatting or even Geo-location and getting co-ordinates and reflecting them in real time. yes PHP can do those but unless you have a better Host with lots of cash on hardwares NodeJS can do the same with limited resources. just thought i mention this out cuz not many developers use it, am eargly waiting for making offline javaScrip applications with NodeJS as Server.
for more info look at http://nodejs.org ciao.