Extjs 4 Socket.io Proxy - extjs

I'm working on a project that uses Node.js as server and the client is a webapp developed using Ext JS 4.2.
The communication protocol relies on the Socket.io library.
I was trying to integrate the socket.io communication in my webapp in a way that is as much as possible polished and compliant to the Ext JS 4's MVC.
The first idea I had was to have a class that was looking like THIS that basically has all the socket.io callbacks which will get the needed Ext JS elements and set the received data to them.
However i saw that ExtJS 4 introduces the concept of Proxy and Stores and I was thinking if what I need can be achieved using these functionalities (I'm a beginner with extjs 4).
Long story made short: What's in your opinion the best practice to handle this scenario? Also: even if it's possible to achieve what I need with proxies/stores, will it be easier and at the same time a good pratice using them in this case or the callbacks way is fine enough?
Any other solution is welcomed.

Related

use reactJS with angularJS

I need to design a huge client side application by following MVC architecture.
As of I know angular is best for developing a SPA by in mvc architecture.
I'm not familiar with ReactJS, when i'm going through ReactJS i came to know that ReactJS is best creating user interfaces and building reusable components.
link https://facebook.github.io/react/docs/why-react.html says React as the V in MVC.
From that my question is:
is it possible to use both angularJS (framework) & reactJS(library) in same SPA.
is it possible to create Views using ReactJS and other part of my application in angularjs (M & C part in MVC).
You are correct, React in itself as a smaller scope than Angular, it is not a so-called "framework" but it's a library used to render views, or components inside a view. You will have to assemble many other libraries around React to get a full SPA application, however the good news is that skilled developers already picked them for you and pulled out very useful boiler plates that should get you started much much faster than if you were to do all the work by yourself.
Take a look at those:
Find your perfect React starter project
react-boilerplate
react-redux-starter-kit
I based my latest app on the 3rd one and I love it, but it's personal ...
Now your questions:
Yes you can use both, take a look at ngReact, let's you run React components in an Angular app. If you start from scratch however and don't have legacy code or libs written in one of the two technologies, my recommendation would be to either use one or the other. This kind of hybrid solution would let you slowly migrate an Angular app to React by rewritting one by one your components without breaking the whole app at once.
That's pretty much what I said in 1/ this can be done but if I were to write the app from scratch I would pick either Angular or React depending on time constraints, existing code base and willingness to learn a new framework. My recommendation: take a few days to experience various boilerplates and pick the one that you feel the most comfortable with...

How to replace Electron's IPC channel in a Web App

I developed an Electron application few weeks ago with the framework AngularJS (used to make the client side). Today, I would like to convert this desktop application to a classic Web App.
The actual client-server communication is made with Electron's IPC channels. But it has to be replaced by something else. However, I don't really know what is the best way to replace them for the communication between my new Node.js server and the HTML pages (the same ones, always made with AngularJS).
I think there is a way to create new ipcMain and ipcRenderer modules to adapt them to the communication between a server and a client. But my skills in JavaScript are not good enought to do it. Does someone know how to make this adaptation, or maybe have a better idea ?
Thanks
A pretty general question. I would use http://socket.io/

Angular2 Multi-page Application Consuming Spring Rest Microservices API

Good day Pals, I have no experience of Angular 2, but a bit of Angularjs 1x. Having done my little research.
I found out that for a new project I am better off going for ng2.
Also, that there is better support for TypeScript against JavaScript.
This is more learning curve for me, since I am from a JS background.
In my project we have built multiple spring bootstrap rest microservices and we need to knock out UI as speedily as possible using Angularjs2, HTML5, CSS3/Bootstrap.
I am looking for a good sample application for Angular2 showing features like: multiple page routing/navigation, templates, directives and components to implement calling our existing rest endpoints/API. Typical CRUD application references will be appreciated etc
It will be good to to see a rich client application partitioned/architectured with best practice in mind.
I have googled and there isn't much out there, I need some expert guidance please. References to code/bloggs/github etc
Thanks in advance.

Can you use AngularJS with Parse.com?

I am new to phonegap development & I am trying to pick a framework to use. I'd like to use AngularJS as I've read good things about it, but I'd like it to work with Parse.com as a backend. I noticed that one Parse.com they don't specify any compatibility with Angular, and all their documentation and Javascript API requires Backbone.
I know AngularJS supports http, so I can communicate with Parse using the REST API. But is this going to end up being a mess & will I save myself time & stress if I use Backbone with the Parse.com Javascript API instead?
I have not worked on Parse, but I believe as long there is a REST API available AngularJS can very well integrate with Parse.com. These links substantiate that fact
https://parse.com/questions/does-any-know-of-any-angularjs-sites-that-are-built-with-parse-that-are-open-source
http://brandid.github.io/parse-angular-demo/#/
Said that, AngularJS is a very capable framework with a steep learning curve. The simple stuff is simple but one needs to put ones head down and start learning the not so simple stuff like directives once one starts building any decent size application. The more you invest in learning AngularJS the more rewarding it becomes.
It has a very clean separation in terms of view and code. The code is further organized into modules, factories, services, controllers, directive, filters etc.
But still nothing stops you from creating a mess with the implementation :) What I have realized over the time is even if you create mess within AngularJS the effects are localized rather than affecting the complete application, due to the modular nature of Angular.
I suggest you try creating or looking at some samples with AngularJS (such as TodoMVC)
This is how i felt learning and implementing AngularJS solutions
Thanks for bring up our Parse x AngularJS boilerplate - we've just updated it today too.
Our entire site getbrandid.com is built with Parse x AngularJS and no servers of our own.
We built this boilerplate after because having spent a few years building BRANDiD, we had a lot of best practices to share with the Parse and AngularJS communities. We think it is a match made in heaven, and is the fastest way to build powerful complex, highly maintainable serverless apps.
We've basically extended the Parse SDK to support AngularJS bindings, we've eliminated a ton of boilerplate code, and most importantly, we've established an architecture for large serverless apps using Parse and Angular.
I highly encourage you to check it out -
Parse x AngularJS Boilerplate
Actually Parse's documentation does not say that you have to use Parse with Backbone, it just says that some stuff are compatible with Backbone classes, like the Collections object, which might be useful ONLY IF you use Backbone.
The big hassle of using 3rd party stuff inside angular is its lifecycle, as it uses POJOs and only watches for changes in these objects at specific points in time - Check the Scope Life Cycle documentation for more info.
Given that, when Parse returns its callbacks, AngularJS might no longer be observing those Parse objets, so you need a way of telling angular that thing changed, and you have to do it inside the digest loop, for example using $scope.$apply
I created a small wrapper for Parse.Query and Parse.Object to avoid the need for $scope.$apply all the time, let me know if you find it useful: https://github.com/felipesabino/angular-parse
The easiest way I found to communicate with the parse.com backend is to use the jimrhoskins/angular-parse Angularjs module that replaces the (backbone) ParseSDK.
Ads instant :-) I included it in this angular/parse boilerplate.
We've been using this method fairly frequently. We decided to document our experience. Its a 2 part series on building angular apps with a parse backend. Hope it helps!

Ext-JS 4 with CakePHP vs Ext.direct

I'm using Ext-JS 4 on client-side and for my server-side I'm using CakePHP. They are communicating with JSON.
I saw that Sencha Team created Ext.direct for communicating with server side (PHP, Ruby, .NET ect.).
So, can you tell me advantages and disadvantages of using Ext.direct over PHP framework like CakePHP or Zend?
As usual, it brings you more organized and structurized code by giving an additional abstraction layer with no or very little performance loss. Use it over your framework. Or do not use. It's up to you.
Ext.Direct is a protocol, not an server-implementation! Ext.Direct has a lot of advantages over standard RESTful or "normal" js requests, because it specifically is written for Sencha Touch and ExtJS and so all models and proxies are already correctly configured and ready to go.
If you are using CakePHP there is a framework called Bancha which implements Ext.Direct into CakePHP. It also handles all the marshalling and data transformations to save you a ton of time.

Resources