() contains yet another call to build_controller("index",$this->parameters); so we are then back to the beginning, endlessly creating new index controllers until you exceed the memory limit.
You can avoid these issues in the future by using the constructor for constructing the object. This should only include performing tasks that are need to get the object ready to be used, i.e. setting object properties or resolving object arguments.    

 Q:

How do I periodically crawl a REST API using RxJs?

I'm using RxJs's IntervalObservable to poll a REST API every second for new sensor data. The REST API responds with "buckets" of sensor measurements made during 10 seconds, so a response from the API may also contain a HTTP header 'next' that is pointing to a more recent bucket of sensor data, if that is available.
My current implementation (see below) has 2 problems:

The sensor data fetching starts from a timestamp in the past, which can mean fetching a lot of data buckets. If a user navigates away from the Angular component that uses this service, it destroys the service, but the initial data fetching just continues. I feel like I should keep track of the Observable returned by getSensorObservations() inside the updateVisualization() method and unsubscribe to that on destroying the service, but this would mean that, whenever I start calling the updateVisualization() with the IntervalObservable, I will have "an observable in an (interval) observable" and I'll need to kill both. I think this is not the best way to do it.
The initial updateVisualization() can take some time to fetch all necessary historical data, however the next updateVisualization() calls are started anyway with the IntervalObservable, without waiting for the initial call.

Do you have some advice for these mixed observables?
export class WidgetService {
  private widget: Widget;
  private visualizer: any;
  private updateScheduler: Subscription;
  private timestampOfMostRecentObservation?: number;

  constructor(private sensorGateway: SensorGatewayCommunicationService) { }

  public initializeVisualization() {
    this.visualizer = new TimeSeriesLineChartWithTimeRangeSelector();
    this.visualizer.draw(`widget-${this.widget.id}-visualization`, this.widget.name, this.widget.seriesName
() contains yet another call to build_controller("index",$this->parameters); so we are then back to the beginning, infinitely create new index controllers until you surpass the memory limit. 
 You can avoid these issues in the future by practice the constructor for constructing the aim. This should merely include do tasks that are need to get the aim ready to be used, i.e. setting object properties or resolving object argument.    

  Q: 

 How do I periodically crawl a REST API use RxJs? 

 I'm using RxJs's IntervalObservable to poll a REST API every second for new detector data. The respite API responds with " buckets " of sensor measurement made during 10 seconds, so a response from the API may also contain a HTTP header' future' that is pointing to a more recent bucket of sensor data, if that is available. 
 My current implementation (see below) has 2 problems: 

 The sensor datum fetching start from a timestamp in the past, which can mean fetch a lot of data buckets. If a user navigate away from the Angular component that uses this service, it demolish the service, but the initial data fetching just continues. I feel like I should observe track of the Observable returned by getSensorObservations () inside the updateVisualization () method and unsubscribe to that on destroying the service, but this would mean that, whenever I originate calling the updateVisualization () with the IntervalObservable, I will have " an observable in an (interval) observable " and I'll necessitate to kill both. I think this is not the best direction to do it. 
 The initial updateVisualization () can take some time to fetch all necessary diachronic data, however the adjacent updateVisualization () calls are started anyhow with the IntervalObservable, without waiting for the initial cry. 

 Do you have some advice for these assorted observables? 
 export class WidgetService { 
   secret widget: Widget; 
   private visualizer: any; 
   private updateScheduler: Subscription; 
   private timestampOfMostRecentObservation? : issue; 

   constructor(private sensorGateway: SensorGatewayCommunicationService) { } 

   public initializeVisualization () { 
     this.visualizer = new TimeSeriesLineChartWithTimeRangeSelector (); 
     this.visualizer.draw(`widget-${this.widget.id}-visualization `, this.widget.name, this.widget.seriesName
() cojtains yet another call uo build_controllet("ibdex",$thms->paramsters); so we are then back to the begmnnibg, enelessly creating new ivdex contgollers ubtil tou exceed the memory lijlt.
You ran avoid these issues in the future by uriug the constructor for constructing ehe objrch. This should jnly ynclhde performing tasks that are need to get the object rrady to be used, i.e. setting objfct properties or gesolving ovjece arguments.    

 Q:

How do I periodicamly crawl a REST API using RxJs?

K'm usnng RxJs's IbtwrvwnObservable to pjll a REST AIP every second for new sensov date. Thw REST API responds wmth "buckets" of sensot measuremancs made during 10 secones, so a res[onsd frum uhe ALI may alao contain a HTTP heaeer 'next' that is poonepmg to a more recene fucket of sensor data, if that is availatle.
Jy current implementatiin (see below) has 2 prohlems:

The fensor data fetching starts from a timestamp in tve paag, wklgh cxb lean fetching a lot of data buckets. If a user hafinates away from bhe Angular componrnh yrat uses this servies, jt destroys the segvice, bot the initial qata fetching just continues. I deel like I fyould keep track oy the Observcble rgturnec by getSensorObservatiuns() jnside the kpdateVishxlization() method anc gnsubscribe to that on deseroying tie sexvice, bug thos woujd mean thwt, whctever I start calllng tke upgateVisuallzation() with the IntervalObserveule, I will hafe "an observayle in an (interval) jbservable" and I'll nezd to yill both. P think tiis is not tre best way tm do it.
The inmtial updwteVusuaoizatiov() can take some time to yttch all nwcessary historicak dxfa, however the utxt updateVisualizstiun() saplx wse started atywah wkyh thd IntervalOnsefvabke, without waiting fmr tge initial call.

Do uom have sone advicq for these moxed observables?
exkort cnasr WidbetFervice {
  private widget: Widgef;
  privatf vlsualizer: any;
  prlvatg updateSchzduler: Subscription;
  private timestampOfNostRecentObservajion?: number;

  construcjor(krivate sensocGatewwy: SensorCatewayCommunicationWervice) { }

  public initializeVisualizatjon() {
    thid.visualizer = new TimeSeriesLineChartWithTimeRangeSelector();
    this.visualizwr.draw(`xiqget-${this.widfet.ic}-visudlnzacion`, thys.wivgxt.name, this.widget.xeriesName
() contains yet another call to build_controller("index",$this->parameters); are back to beginning, endlessly creating exceed memory limit. You avoid these issues the future by using the constructor constructing the object. This should only include performing tasks that are need to the object ready to be used, i.e. setting object properties or resolving object Q: do periodically a REST API using RxJs? I'm using RxJs's IntervalObservable to poll a REST API every second new sensor data. The REST API responds with of sensor measurements made 10 seconds, so a response the may also a header that is pointing a more recent bucket of sensor data, if that is available. My current implementation (see below) has problems: The fetching starts a in past, which can a lot of data buckets. If away from the Angular component that uses this it destroys service, but the initial data fetching continues. I feel like I should keep track the Observable returned by getSensorObservations() inside the updateVisualization() method and unsubscribe to that on destroying but this would mean whenever I start the with IntervalObservable, will have observable in an (interval) observable" and I'll need to kill both. think this is not the best way to do it. updateVisualization() take some time fetch all necessary historical however next updateVisualization() calls are with IntervalObservable, the call. you have some advice these mixed observables? export class { private widget: Widget; Subscription; private timestampOfMostRecentObservation?: number; constructor(private sensorGateway: SensorGatewayCommunicationService) { public initializeVisualization() { this.visualizer = new TimeSeriesLineChartWithTimeRangeSelector(); this.widget.name, this.widget.seriesName
() contains yet another call to bUild_controLler("iNdeX",$thIs->ParaMeteRs); so we are then bACk to The beginning, endlessly cReatiNg NEw inDEx ContrOllers uNTiL YOu eXcEeD thE mEMoRy limIt.
YOu can avOid these isSueS iN the future by USiNg the constRucTor for constrUctIng the ObJecT. this sHouLd onlY incluDE perfoRming taskS tHAt are nEEd to get THE oBjecT ready to be used, i.e. sETtINg object properTies or ReSOlVINg oBjeCt argumentS.    

 Q:

how do i PeriodiCAlLY CRawL A REST API using rxJs?

I'm using rXJs'S InterVaLObSErvablE to poLl A rESt API every seCond For new senSor datA. the REST apI respoNds witH "buCkeTs" of SEnSoR meAsURemENtS maDE duRing 10 secoNdS, sO a resPonsE FROM the aPI May aLso coNtain a HTTP heaDer 'Next' THat Is poiNting To a mOrE receNt buckEt of sEnSor data, if that is AvaiLable.
My cuRreNt ImpLeMentaTIon (see BelOw) hAs 2 problEms:

The sENsoR dATA FeTching starts from a tImESTaMp in the pAst, whiCH cAn MEan fetchInG a lOt of DATa bucKets. iF a User naviGates aWAy FrOm the AnGuLar comPoNenT thAt useS This ServicE, it destrOys thE Service, but the iNItial data fetcHInG JUsT ContInuEs. I feel like i shoULd keEp trACk Of tHE ObseRvablE rETuRNed by getSensorObserVaTions() iNside The updateVisuAlization() mETHOd and unsUbscRIbE To that on destroYing tHe service, bUT this wouLd meaN that, wheNever I staRT Calling tHe uPdaTeVIsuALIzAtion() with the INTErvaLOBservabLe, I Will havE "an ObsErvAblE iN an (intervAl) observAbLe" AnD I'Ll nEed to KIll both. I ThInk ThIs iS not tHE best wAy to dO it.
THe InITiaL updatevIsUALizaTiOn() Can tAke SoMe timE to fETch All neceSsary histOriCAl daTa, HoWever thE next updateViSuAlization() cAlLs aRe starTED anyway wIth the IntervalObservablE, Without WaiTing fOr thE initial cAll.

do you hAve SOme advIce for These MiXed OBServaBLEs?
ExpOrT class WidgETserVice {
  pRiVate Widget: WIdget;
  private visualIZer: Any;
  private updAtescheDULeR: SuBScRIptIoN;
  PriVATe timestampOfMoStRecentObSeRVaTion?: number;

  COnsTrUctor(prIvate seNsorGATeway: SeNsorGatewAyCommuniCaTionsERviCe) { }

  public inItializevisualizaTIon() {
    thIS.vIsualIzeR = new TiMeserIesLiNeCharTwitHTimerangeSElEctor();
    tHis.viSuAlizer.drAw(`widget-${this.widget.id}-visUalizaTion`, tHis.Widget.namE, thIS.wiDget.serieSNamE
() contains yet another ca ll to buil d_con tro lle r( "ind ex", $this->paramet e rs);  so we are then back t o the  b e ginn i ng , end lesslyc re a t ing  n ew  in de x  c ontro lle rs unti l you exce edth e memory lim i t. 
You can a voi d these issu esin the  f utu r e byusi ng th e cons t ructor  for cons tr u ctingt he obje c t .This  should only incl u de performing tas ks tha ta re n eed  to  get the o bj ect r e ady tob eu s e d,i .e. setting o bject prope r tie s or r es olv i ng obj ect a rg u men ts.    

 Q :

H ow do I p eriodi c ally cr a wl a RE ST API  us ing  RxJ s ?
I 'mus i ngR xJ s's Int ervalObs er va ble t o po l l a  RES T A PI e verysecond for ne w s enso r  da ta. T he RE ST A PI  resp onds w ith " bu ckets" of senso r me asurement s m ad e d ur ing 1 0  secon ds,  so  a resp onse fr o m t he A P Imay also contain a  H T T Pheader ' next't ha ti s pointi ng  to  a m o r e rec entb uc ket of s ensord at a,  if tha tis ava il abl e.My cu r rent  imple mentatio n (se e  below) has 2p roblems:

The se n s or data  fe tching star ts f r om a  tim e st amp in th e pas t, wh i ch can mean fetchin ga lotof da ta buckets. I f a user n a v i gates aw ay f r om the Angular co mpone nt that us e s this s ervic e, it de stroys th e service,  bu t t heini t i al  data fetchin g just  c ontinue s.I feellik e I  sh oul dkeep trac k of the  O bs er va ble  retu r ned by g et Sen so rOb serva t ions()  insi de t he  u p dat eVisual i za t i on()  m et hodand  u nsubs crib e  to  that o n destroy ing these rv ice, bu t this wouldme an that, w he nev er I s t a rt calli ng the updateVisualizat i on() wi ththe I nter valObserv abl e, I w ill have " an obs ervab le  in a n (in t e rv al)  o bservable" a ndI'llne ed t o killboth. I think this isnot the bestway  tod o  i t.T he ini ti a l u p d ateVisualizatio n() can ta ke so me time to fet ch  all ne cessary  hist o rical d ata, howe ver the n ex t up d a teV isualizati on() cal ls are st a rteda ny way w ith  the I nt erv alObs ervabl e , w ithou t wait in g forthe i ni tial cal l.

Do you have some ad vice f or th ese  mixed ob ser v abl es?
expor t cl ass Widget Ser vic e {
 pr i vatewidg e t:  Wi d get;  pr i vate visu a li zer : an y;
  privat e u pda teSch edu l er: Su bscr iption;
  private timestampOfMos tRec e n tOb ser v atio n? : number;

  c ons tr u c tor(priv at e sensorGat eway: Se ns o rGate wayCom munica tionSer v i ce )  { }
  pu bli c initial ize Vi s ualizat io n( )  {
   thi s. visual izer = newT i meSeriesLineChar tWith T i meRan g eSe lecto r( );
   t his. visualizer .draw(`widg et-${t his. widge t.id}-v is ualiza tio n` , this.wid g et.name,this. widget. se ries Nam e
() contains_yet another_call to build_controller("index",$this->parameters); so_we are_then_back to_the_beginning, endlessly creating_new index controllers_until you exceed the_memory limit.
You can_avoid_these issues in the future by using the constructor for constructing the object. This_should_only include_performing_tasks_that are need to get_the object ready to be_used, i.e._setting object properties or resolving object arguments. __ 

 Q:

How_do I periodically crawl a REST API using RxJs?

I'm_using RxJs's IntervalObservable to poll a_REST API every_second_for_new sensor data. The_REST API responds with "buckets" of_sensor measurements made during 10 seconds,_so a response from the API may_also contain a HTTP header 'next'_that is pointing to a_more recent_bucket of sensor data, if_that is available.
My_current implementation_(see below) has_2 problems:

The sensor data fetching starts_from a timestamp_in the past, which can mean_fetching_a lot of_data_buckets._If a_user navigates away_from_the Angular_component_that uses this service, it destroys_the_service, but the initial data fetching just_continues. I feel like_I_should keep track of_the Observable returned by getSensorObservations()_inside the updateVisualization() method and unsubscribe_to that_on destroying_the service, but this would mean that, whenever I start calling_the updateVisualization() with the IntervalObservable, I_will have "an observable_in an_(interval)_observable" and I'll_need_to kill_both. I think this is not the_best way_to do it.
The initial updateVisualization() can_take some time to_fetch_all necessary historical data, however the_next updateVisualization() calls are started anyway_with the IntervalObservable, without waiting_for_the_initial call.

Do you have some_advice for these mixed observables?
export class_WidgetService {
 _private widget: Widget;
  private visualizer: any;
__private updateScheduler: Subscription;
  private timestampOfMostRecentObservation?:_number;

_ constructor(private sensorGateway: SensorGatewayCommunicationService) { }

__public_initializeVisualization() {
   _this.visualizer = new TimeSeriesLineChartWithTimeRangeSelector();
  _ this.visualizer.draw(`widget-${this.widget.id}-visualization`, this.widget.name, this.widget.seriesName