Showing posts from 2012

Schedule your Azure Mobile Service Pinger - Part 2

This is a continuation of  my previous blog. As an update to the Scheduler script I have incorporated the script with the Email and  sms module. I have used Sendgrid to send the email and Smslane to send the sms.

The scenario is whenever the url or web service is down a sms and an email will be sent to the administrator.

Following is the script

function Pinger() {

    //Import the modules that you will require to perform this request

    var req = require('request');
    var util = require('util');
    var sql;
    var responseStatus;
    var time = new Date();
    var SendGrid = require('sendgrid').SendGrid;

    //Send request to the url which you want to monitor. Note this is a get request
    headers:{'content-type': 'application/x-www-form-urlencoded'},      

   //Write the callback module for the same
   function (error, response, body) {
   if (!error && response.statusCode == …

Schedule your Azure Mobile Service Pinger

This is a continuation of my previous blog Create your own monitor with AMS. In my previous blog I had mentioned how we can create an URL ping monitor using Node.JS nodes in AMS. However there was something missing!
For any URL or service monitoring it does not make any sense until and unless it is scheduled. The actual flow should be a background task which will be scheduled after a specific time interval and execute the business logic which will do the pinging request. This was a little bit difficult until few days ago, when the Azure Mobile service team released Scheduler service.
Scheduler scripts were used to
1.Support background processing
2.Prune unnecessary data
3.Send push notification after an interval
To explore this more I started integrating the Ping script
Step1: Go to your azure management portal -> Click on your Mobile Service.

Step 2: Double click on the service and click on the scheduler tab

Step 3: On clicking “Create a scheduled job” you will be asked about the Jo…

Create your own freaky chat server in 10 minutes :)

This blog is how Node.JS helps to make a chat server in just 10 min time span. When this code first worked out at my end I felt awesome as in my past experience creating a chat server was cumbersome. The algorithm for creating a chat server is simple
1.Create a socket array which will contain all the sockets
2.Each socket represent an user who wants to chat
3.Server should open a port for listening
4.Each socket chat message data to this port
5.Once the data is received it is broadcasted to all the existing socket in the socket array.
Server side script
//Require net module for create socket connection
var net = require('net');
//Initialize the Socket array which will hold the current logged in used socket
var sockets = [];
var s = net.Server( function(socket) {
//Whenever there is a data sent from any user, the data will be pushed to all the existing socket connections
sockets.push (socket);
socket.on('data', function(d){
for(var i=0;i<sockets.length; i++)

Unseeing possibilities through Node.JS

What is Node.JS?
Node.JS is a server side event driven I/O to build fast, scalable network applications. To know more about Node.JS you can get more information at . In this blog I am more focused to talk on the practical done by me.
Node.Js is all about:
1.Asynchronous I/O Framework
2.Core in C++ on top of V8
3.Rest of it in Javascript
4.Can handle thousands of concurrent connections with minimal overhead (CPU/Memory) on a single process
5.Works upon v8 which is a potent platform developed by Google in C language. Node.JS sits above V8 and uses the APIs of V8
Once you download the Visual SDK toolkit for Node.JS you can verify the same with node command. Following sample shows how to write a simple addition and multiplication function and call them

Similarly you tend to do some management related operations like monitoring the event Eventemitters by calling the process command.
Let’s start with some real world application, like pinging a URL and getting it…
Create your own URL monitor with AMS
In this blog I will discuss about the important role of Node.JS module(request) in Azure Mobile Service. I will like to take an example and explain how easily a simple URL monitoring application which took a lot of effort earlier was coded in just few hours.
The new Azure Mobile service provides the developers some standard node.js modules that can help them to code for CRUD related transactions. Richard Astbury has written a wonderful blog mentioning those standard modules. In addition to these standard modules some new modules that have been added recently are as follows:
We will be talking about the request module which has been recently added as a supported module to Azure mobile service. Let me start with the problem statement that was the origin of such an app. Situation
·I have 5 web service hosted by my application. I want to verify their status right now. I want a one click solution for the same
·I want to monitor whether…

Common Port related Troubleshoot in Azure

Common Port related Troubleshoot
This blog is mainly focused on issues that we face coding from behind a firewall. The content of this blog has be prepared gradually on basis of experience, and thus it has some contents discussed which were tested on the old management portal.
For Security reason, we tend to allow few ports for internet access. Mainly in organizations where there is a restricted access to ports, one may face different kinds of accessibility issues. To access different features in Azure there are some specified ports that one should look for and give permission to allow access. This blog will discuss situations where this kind issue is faced and how can we resolve them. Port 1433SQL Azure Connectivity If you are planning to use SQL Azure as your backend, verify that the communication from your VSTS 2008 or 2010 to SQL Azure is working fine. When you create a database, you are given a database name. <<database Name>> To ensure that the SQL Az…

Execute read query in Azure Mobile Services

Microsoft had their cloud services from past many years. Traditionally developers have to spend good amount of efforts in writing the service related code. With the advent of Windows 8, Microsoft is helping developers to focus more on client based application development. Their major intent is to give fewer burdens to the developer for Server side development and let him/her focus more on metro style app development. With these intentions in mind, they released a very light weighted product called Azure Mobile Service. I will recommend anyone who wants to explore Azure Mobile service to watch the video on the same by Josh Twist at Channel 9 Azure Mobile Service comes with easy installation and usage guide. Creating a new Windows 8 or Windows Store app and integrating it with Azure mobile service is pretty straightforward. Here in this blog we will focus on ways to read entities from Azure Mobile service and how to effectively use them. To get started with Azure Mobile Service you can br…