title: How to get an observable to return data immediately and every 5 seconds thereafter
body: <p>I want to create an observable that returns data from a webapi.  I'd like it to return the data immediately, and poll the API every 10 seconds.  The code below shows I'm using the 'interval' method.  But this delays the first set of data by 10 seconds.  How do I get that first flush of data to come down with no initial delay?</p>
  
  <pre class="lang-typescript prettyprint-override"><code>export class EventService {
      public events$: Observable&lt;Event[]&gt;;
      private _eventsObserver: Observer&lt;Event[]&gt;;
      private pollInterval: number = 5000;
  
      private _dataStore: {
          events: Event[];
      };
  
      constructor(private http: Http) {
          this._dataStore = { events: [] };
  
          this.events$ = new Observable(observer =&gt; this._eventsObserver = observer)
              .startWith(this._dataStore.events)
              .share();
      }
  
      pollEvents() {
          return Observable.interval(10000)
              .switchMap(() =&gt; {
                  return this.http.get('app/resources/data/scheduleevents.json')
                      .map((responseData) =&gt; {
                          return responseData.json();
                      });
              })
              .map((events: Array&lt;any&gt;) =&gt; {
                  let result: Array&lt;Event&gt; = [];
                  if (events["data"]) {
                      events["data"].forEach((event) =&gt; {
                          result.push(event);
                      });
                  }
                  return result;
              });
      }
  }
  </code></pre>