Solved

Angular 2 and server connection

Posted on 2016-11-06
4
23 Views
Last Modified: 2016-11-08
Hello there,

I have a question about Angular 2 as Client UI and Vertx as my server and Cassandra as my database. I want to know do i need to use RxJS to communicate between the Client UI (Angular 2) and my server (Vertx) or I do not need RxJS. I also intend to use Web-socket protocol instead of HTTP. Can you please help me to figure this out.. Appreciate your help.

cheers
Zolf
0
Comment
Question by:zolf
  • 2
  • 2
4 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 41876137
Well the first thing to avoid is building all the infrastructure yourself - which will be fraught with gotchas. There is an Angular service for Vertx - https://github.com/knalli/angular-vertxbus - which one could probably directly use in Angular 2. This service will hide all the details about the communication, but don't forget that Web Socket protocol is negociated via HTTP (it doesn't have to be but it normally is).

As far as Cassandra is concerned this will hide behind Vertx so you'll just need the the Vertx plugin or whatever for Cassandra.

Peronally I'd stick to using Node.js instead of Vertx and simply use HTTP/HTTPS. There's a Node driver for Cassandra and a plugin for Express and there's a LOT of experience and tools for this stack.

https://academy.datastax.com/resources/getting-started-apache-cassandra-and-nodejs
https://www.npmjs.com/package/express-cassandra

I don't see any advantage in using Web Socket protocol given the asynchronus nature of Angular - made even more asynchronous with Angular 2. But if you have Promised......
0
 

Author Comment

by:zolf
ID: 41876610
Thank you for your feedback. I appreciate it!!
So, you recommend me to use NodeJs instead of Vertx. correct? Can you please tell me the pros and cons of Nodejs compared to Vertx and the reason you will go for Nodejs. Thanks
0
 
LVL 27

Accepted Solution

by:
BigRat earned 500 total points
ID: 41876995
I must admit I have not used Vertx, but I have used Node.js and Express with Passport. Although there are literally hundreds of tutorials on Node in the Internet, I'm rather old fashioned and still read books. And I prefer the paper ones.

Now looking in Amazon there are quite a lot on Node and Express. I have bought and used "Node.js the Right Way" and "Node.js is Practice". On the other hand there is only one on Vertx, from Pakt Publishing and that one deals with Mind maps and uses Mongo as a database. The Mean stack is Mongo, Express, Angular and Node and this stack is very well described in a variety of books. There are also a lot of places around where you can find help. Particularly with Angular 1. Now that Angular 2 has arrived - with a React like component architecture - it won't be long before the bandwagon creates the necessary resources for the common developer.

Now what exactly is your app requirement and why the scalability which Cassandra brings? If you are looking to store images then you'd be wise to use an Angular service to extract photos from a camera (like ng-camera but there others), use a service to send them to node and a node plugin to talk to the database. You ought to be able to switch databases by simply switching node drivers. And I'd be careful about horses for courses. Namely if I were to store pictures in Cassandra, I'd do user login NOT in Cassandra but in Mongo, for example. That is I'd split the functionality into bits, and apply the relevant technology to those bits. Express authorization with Mongo is a well designed system.
0
 

Author Closing Comment

by:zolf
ID: 41878351
cheers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now