title: How to close eventSource with redux action in saga?
body: <p>I want to start and stop eventSource by buttons. Start button with CONSTANTS.FETCHING_STARTED action and stop button with CONSTANTS.FETCHING_STOPPED action.</p>
  
  <p><a href="https://github.com/redux-saga/redux-saga/issues/940" rel="nofollow noreferrer">https://github.com/redux-saga/redux-saga/issues/940</a> - not works for me.</p>
  
  <p>I've tried stop and start in one function, but it didn't work.</p>
  
  <p>This is my saga.</p>
  
  <pre><code>import {
    call,
    take,
    takeLatest,
    put,
    race,
    cancelled
  } from "redux-saga/effects";
  import { eventChannel, END } from "redux-saga";
  
  import * as CONSTANTS from "../constants";
  
  export function* innerSSE(eventSrc) {
    const eCh = eventChannel(emitter =&gt; {
      eventSrc.onmessage = msg =&gt; {
        emitter(msg);
      };
  
      eventSrc.onerror = () =&gt; {
        emitter(END);
      };
  
      return () =&gt; {
        eventSrc.close();
      };
    });
  
    try {
      yield takeLatest(eCh);
    } finally {
      if (yield cancelled()) eCh.close();
    }
  }
  
  function* start() {
    const eventSrc = new EventSource(CONSTANTS.STREAM_URL);
    const chan = yield call(innerSSE, eventSrc);
  
    while (true) {
      const msg = yield take(chan);
  
      yield put({
        type: CONSTANTS.FETCHING_IN_PROGRESS,
        payload: JSON.parse(msg.data)
      });
    }
  }
  
  function* stop(eventSrc) {
    // innerSSE.close()
  }
  
  export function* sseSaga() {
    while (true) {
      try {
        const started = yield take(CONSTANTS.FETCHING_STARTED);
  
        yield call(start, started);
      } catch (error) {
        console.log(error);
      }
    }
  }
  </code></pre>