Solved

Angular 2 and server connection

Posted on 2016-11-06
4
14 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
cheers
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

You have this traditional web application that refreshes the whole page each time you navigate and you think it's a good time to convert it to a Single-Page approach. What should you know in advance? Read on, I'll guide you through it.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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.

771 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

7 Experts available now in Live!

Get 1:1 Help Now