title: Receiving Flux SSE in Angular 5
body: <p>I have succesfully implemented this mechanism in my application:
  <a href="https://vividcode.io/Spring-5-WebFlux-with-Server-Sent-Events/" rel="nofollow noreferrer">https://vividcode.io/Spring-5-WebFlux-with-Server-Sent-Events/</a>
  I can receive events with curl every second, as shown in the example.</p>
  
  <p>My problem is: I cannot receive these events in Angular 5. I have tried many things. Currently my service code looks like this:</p>
  
  <pre><code>public getMigrationProgress(processName: string): Observable&lt;any&gt; {
      let headers: HttpHeaders = new HttpHeaders();
      headers = headers.append('X-Authorization', this._sessionService.getAuthToken());
      headers = headers.append('accept', 'text/event-stream');
  
      let url = config.restApi.url + this.getResource() + '/' + processName;
      return Observable.create(observer =&gt; {
          let eventSource = new EventSourcePolyfill(url, { headers: headers });
          eventSource.onmessage = (event =&gt; {
              observer.next(event);
              this.zone.run(() =&gt; {
                  console.log('prpprpr');
              });
          });
          eventSource.onopen = (event) =&gt; {
              observer.next(event);
          };
          eventSource.onerror = (error) =&gt; {
              if (eventSource.readyState === 0) {
                  console.log('The stream has been closed by the server.');
                  eventSource.close();
                  observer.complete();
              } else {
                  observer.error('EventSource error: ' + error);
              }
          };
      });
  }
  </code></pre>
  
  <p>It only opens connection, does not receive events (Method onopen works once, onmessage - never). Server sends them though.</p>
  
  <p>Any ideas how to fix this?</p>