Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala + Play + Akka. Is there a need for Backbone.js?

My backend is in Postgres. I'm using Scala to build APIs of it.

Everytime there is a change in the database, I want my chrome extension to be notified. I've a few questions regarding this:

  1. Should I implement websockets here or do long polling?
  2. If web-sockets, are there any good examples of how do I do it using scala + play + Akka and javascript?
  3. I believe that I've to implement something called as an observer pattern that notifies my chrome extension if there is any change in data. Is there any other pattern that I should follow to get such a thing done with the minimum DB over-head.
  4. Should I use Redis or RabbitMQ to deal with this particular notification part of things?
like image 231
Hick Avatar asked Aug 04 '12 07:08

Hick


People also ask

Is Backbone JS still relevant?

Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.

What is the purpose of backbone JS?

Backbone. js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.

Who uses backbone JS?

Who uses Backbone. js? 3466 companies reportedly use Backbone. js in their tech stacks, including Uber, Pinterest, and reddit.

Is Backbone JS frontend or backend?

Front-End MVC frameworks (Backbone, Angular, etc) all rely on a backend service to provide the data that, say Backbone, would then use as its model. You could have an entire MVC pattern on the backend that accepts requests and spits out some JSON for a frontend MVC framework to use.


1 Answers

1) I would use http://socket.io/

3) This is interesting question. Observer pattern is commonly used on front end. I would recommend you to check out this article http://addyosmani.com/largescalejavascript/. It helped me to better structure my application. It is basically Pub/Sub pattern with EventBroker/Mediator between. It would be idealy to decouple publisher and subcriber. You can place EventBroker in your application namespace. In this way you have access to message bus from your modules, without needing to pass reference through modules all the time.

4) We have used redis for real/time notifications on website that have similar functionality like pinterest. I am impressed with redis performance.

like image 96
svlada Avatar answered Nov 15 '22 19:11

svlada