Sakib Sami' Blog

Newbie programmer, Java fan, Rosogolla lover, Mom's little kid.

Angular2 async http request

Imagine your are developing a real time data processing app where you have to do chained http request in 5 seconds of interval.

How you can do that ?
Simple, use rxjs Observable to handle 5sec delayed event and on the event do http request.

import {Observable} from "rxjs";

// You can write it where ever you want, here I'm putting it in OnInit
    const timer = Observable.timer(5000, 5000);
    const subscription = timer.subscribe(
        (time: any) =>  {
            // It will be called on every 5sec
                data => {
                    // Response
                err => {
                    // Error

    return, _params)
           .map(function (res) {
              return res.text();

If you want to stop / unsubscribe,


Angular2 with MQTT

In package.json add, "ng2-mqtt": "^0.1.2" npm install it will install dependencies. Now in your com…

angular2, angular, mqtt

Steak Inside || Java Inside

Steak Inside is a burger item made with a large piece of chicken, cheese and other things. I am a bi…

java, heap