1

I have tried this tutorial:

http://kodeinfo.com/post/realtime-app-using-laravel-nodejs-angularjs-redis

which in short is building a real time app by using Node.js + Angular + Redis + Socket.io + Laravel (PHP as a backend).

The question that is bugging me is why try to leverage all of these technologies just to implement a real time feature? Are there any more benefits to using this (Node.js + Angular + Redis + Socket.io) stack over, lets say, simple AJAX call to the backend? For what other use cases you have used this stack?

funguy
  • 1,914
  • 7
  • 24
  • 38

1 Answers1

12

Each of the technologies you've listed is not required for real-time, however I think you might find it useful to get further understanding of each technology and it use.

Each technology has it's advantages and usages. I would suggest you do some more in-depth reading on each technology separate. You can always use just ajax but you're missing out on a lot of the advantages of each technology. All of these are highly tested, DRY and componentize, meaning you'll prob be productive quicker and re-invent less of the wheel.

Furthermore these technologies tend to work really well together, and are based on many similar concepts.

  1. Node.js - you'll need some backend technology for sure, you can use php, node.js or whichever you prefer. However node.js has some clear advantages. Aside from being JavaScript, so you can share code, and node.js non-blocking i/o allowing you to use more resources.
  1. Why use node
  2. Top 10 reasons to use node
  3. How to decide when to use Node
  1. Angular - angular is your front-end mvc. There are many frameworks (Ember, Backend and many others). you can pick anyone or pick none, however this does not replace AJAX. Their framework bring loads more such as two way data-binding, components, data layer and so much more. again great building blocks to build a high impact professional app.
  1. Why use angular
  2. Three reasons to use angular
  3. what does angular do better than jquery
  1. Redis is a nosql database. Real-time has very little to do with it, however it can be used for that. However it has been used for many pub-sub implementation to maintain state across instances / clients. Have a read about Redis
  1. What is redis and when to use it
  2. why is redis ecosystem flourishing?
  1. Socket.io - This is the most real-time oriented component and the main one you might actually "replace" with Ajax. I would strongly urge you, than even if you decide not to use any one of the other component, you still use socket.io/another socket library. Socket.io provide browsers / servers with a socket like interface (similar to winsock on windows). Meaning browser can send and receive messages. Just FYI socket relies heavily on Ajax, however it simplifies the usage and does not require you yourself to main the connection state, handles browser inconsistencies and much more. While you could potentially write faster code using plain Ajax, more chances are you'd end up introducing more issues...However it's your call :)
  1. Why use socket.io
  2. Ajax vs Socket.io performance
Sinan Samet
  • 5,034
  • 11
  • 40
  • 80
Dory Zidon
  • 9,328
  • 2
  • 20
  • 33