concept rxjs in category angular

appears as: RxJS, rxjs, The RxJS, RxJS
Angular Development with Typescript, Second Edition

This is an excerpt from Manning's book Angular Development with Typescript, Second Edition.

Listing 6.5. asyncpipe/app.component.ts
import {Component} from '@angular/core';
import 'rxjs/add/observable/interval';
import {take} from 'rxjs/operators';
import {Observable} from "rxjs";

@Component({
  selector: "app-root",
  template: `{{numbers$ | async}}`         #1
 })
export class AppComponent {

  numbers$: Observable<number> =
             Observable.interval(1000)     #2
                .pipe(take(10));           #3
 }
Listing 13.4. observable.service.ts
import {Observable} from 'rxjs';

export class ObservableService {

  createObservableService(): Observable<Date> {       #1

      return new Observable(                          #2
           observer => {                              #3
               setInterval(() =>
                  observer.next(new Date())           #4
               , 1000);
          }
      );
  }
}

RxJS offers an implementation of the WebSocket service based on the Subject explained in section D.6 in appendix D. The RxJS Subject is both an observer and observable. In other words, it can receive and emit data, which makes it a good fit for handling WebSocket data streams. The RxJS WebSocketSubject is a wrapper around the standard browser WebSocket object and is located in the rxjs/websocket file.