title: Angular2/typescript and SSE (EventSource)
body: <p>First of all, I`m quite new to ng2 and typescript.</p>
  
  <p>What Im trying to accomplish is to implement Server-Sent events in Angular2 component.
  I have followed the examples mentioned in earlies posts here, but my problem is that the "EventSource" object is unrecognized (red underline, in VS Code).</p>
  
  <p>Im not sure if I`m missing some references...
  My references are:</p>
  
  <pre><code>&lt;!-- IE required polyfills, in this exact order --&gt;
    &lt;script src="node_modules/es6-shim/es6-shim.min.js"&gt;&lt;/script&gt;
    &lt;script src="node_modules/systemjs/dist/system-polyfills.js"&gt;&lt;/script&gt;
    &lt;script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"&gt;&lt;/script&gt;
    &lt;script src="node_modules/angular2/bundles/angular2-polyfills.js"&gt;&lt;/script&gt;
    &lt;script src="node_modules/systemjs/dist/system.src.js"&gt;&lt;/script&gt;
    &lt;script src="node_modules/rxjs/bundles/Rx.js"&gt;&lt;/script&gt;
    &lt;script src="node_modules/angular2/bundles/angular2.dev.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>This is how I have Implemeted the eventsource client:</p>
  
  <pre><code>   ngOnInit() {
        const observable = Observable.create(observer =&gt; {
          const eventSource = new EventSource(/API_URL); //Cannot find EventSource
          eventSource.onmessage = x =&gt; observer.next(x.data);
          eventSource.onerror = x =&gt; observer.error(x);
  
          return () =&gt; {
              eventSource.close();
          };
      });
  
      observable.subscribe({
          next: guid =&gt; {
              this.zone.run(() =&gt; this.someStrings.push(guid));
          },
          error: err =&gt; console.error('something wrong occurred: ' + err)
      });
  </code></pre>