Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs vs SignalR: why do we need server-side javascript?

Since I've known about Node.js, I've always been a fan of it. But today I found about SignalR, which provides an alternative asynchronous - scalable - realtime model for ASP.NET.

As far as I know, the main advantage of Node.js over SignalR is sharing code between client-server (another advantage should be that it is cross-platform), and the main advantage of SignalR is a much more mature framework and far better tool (IDE) support. So I wonder: if SignalR is here, do we need Node.js on Windows anymore? Are there any advantages of Node.js I don't know?

like image 504
Quan Mai Avatar asked Jan 30 '12 07:01

Quan Mai


People also ask

Do I need node js server side JavaScript?

For instance, if you wanted to store some data in a file or a database, you'd need to employ the use of a server-side language or application. Node. js is labeled as a JavaScript run-time environment because it uses JavaScript to conduct backend processes.

Why is node js server side JavaScript?

Node. js is a runtime environment to allow JavaScript to not only be run in the browser, but also on the server (or almost any environment, really). That also expanded the types of applications that could be built with the language since it wasn't tied to only the client-side anymore.

Why do we need server for node JS?

Strictly speaking, you don't need to put a web server on top of Node. js - you can write a small server within your Node project and have that handle all routine browser requests as well as those particular to the web app concerned. But things like webpage changes are handled better by a web server, e.g. Nginx.

What is server side JavaScript used for?

Server Side JavaScript (SSJS) is an extended version of JavaScript that enables back-end access to databases, file systems, and servers. Server side javascript, is javascript code running over a server local resources , it's just like C# or Java, but the syntax is based on JavaScript. A good example of this is Node.


1 Answers

SignalR is a viable alternative to Socket.IO and Node.js. There are other reasons to use javascript on the server however.

  1. It flattens the stack. Almost any website these days has to have javascript on the browser, and if you use it on the server as well, you can cut one language out of the batch that you'll have to be proficient in.

  2. Message passing is very natural. JSON Everywhere! Especially combined with a document database which uses JSON, all message passing just becomes JSON objects. This makes reduces the amount of message brokering that has to happen throughout the system.

  3. It's not Microsoft. I personally love what Microsoft has done for the development community. They make fantastic tools and one of the best frameworks and languages around. That being said, some people just love to hate Microsoft.

  4. Cost. There are many good ways to get Microsoft tools for free or very cheap (Express editions and Biz Spark). There is still a higher cost associated with working with Microsoft tools. I believe this cost is worth the productivity gains in most instances, but not everyone agrees.

In addition to the above, there is still the story going around that you can't scale long polling requests on IIS due to the threading model. This has some truth to it, but with good code design, and some server tweaks, you can mostly get around these problems.

like image 149
Timothy Strimple Avatar answered Oct 07 '22 20:10

Timothy Strimple