ActionСable is easily integrated WebSockets with the Rails application parts. It allows you to write real-time functionality with Ruby style according to the rest Rails application functionality, at the same time being productive and scalable. It is a full stack, including the client framework in JavaScript and server-side framework in Ruby. You get access to the models, written with Active Record or other ORM.
So what’s the point of this post? I am gonna create a chat application on base Rails+Ionic2, note for angular2 it's same. And tell how easily integrate Rails ActionCable into your Angular2/ionic2 application.
The Ionic Framework enables the creation of cross-platform mobile applications with HTML, CSS, and JavaScript(Angular). Ionic 1 was built withAngular 1.*, and with Angular 2 recently released, the second major version of Ionic is also imminent.
Ionic 2 has just hit Release Candidate stage, and if you are looking to build cross-platform apps quickly, and you already know Angular 2 or JavaScript, this guide will get you up to speed.

So, first of all, let’s initialize a new rails application:

rails new chat --api -d postgresql
rails db:create

Well done, now we should add gemfiles. A Gemfile is a file we create which is used for describing gem dependencies for Ruby programs. Your Gemfile should always be in the root of your project directory, this is where Bundler expects it to be and it is the standard place for any package manager style files to live. It is useful to note that your Gemfile is evaluated as Ruby code. When it is evaluated by Bundler the context it is in allows us access to certain methods that we will use to explain our gem requirements.

Ionic CLI and Cordova
To create Ionic 2 projects, you’ll need to install the latest version of the CLI and Cordova. Before you do that, you’ll need a recent version of Node.js. Download the installer for Node.js 6 or greater and then proceed to install the Ionic CLI and Cordova for native app development:
npm install -g ionic cordova