Enabling Node.js WebSockets on Azure Web App

Recently I found myself confused by a websocket issue on an Azure deployment of a Node.js Socket.io app. In order to run WebSockets on an Azure WebApp or Website, you need to turn off IIS WebSockets module which conflicts with the Node.js WebSockets.

To do this, you have to turn on WebSockets in the configure of the app and do one of two things:

Option 1:

Create the following web.config file in your root folder prior to pushing to the Azure website:

Option 2:

FTP into your website’s location using the URL found in the Azure Management Portal and replace the web.config file in \site\wwwroot location with the content above.

Source:

http://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-chat-app-socketio/

Node.js with SparkJS on a Website

Never used Node.js before? Want to test out SparkJS? This is the guide for you.

Background: I have done some development in Node.js before to build websites and small maker projects, but it has been a while since I touched Node.js, so I needed a refresher when I decided to work with the SparkJS package.

Things you will need:

Install node & npm

This will start up the basic express web server that you can navigate to from a web browser by going to the url: http://localhost:3000/

Create an index.html file in your myapp\views folder with the content from here:

Add another line at the end of the index.jade file that says

The whole project can be found at https://github.com/anthony-ngu/sparkjs-example

In order to download the proper node modules, you will need to run the following command from the example directory:

Reading Material: