Streaming events with redux-saga
We’ll repeat a lot of the same techniques in this section. There are two new concepts: first, pulling out the search
param for the watcher ID, and second, using eventChannel
to subscribe to the onmessage
callback. This is used to continually stream messages from the WebSocket into the Redux store.
Let’s being by specifying the new URL behavior:
- Write a new
describe
block at the bottom oftest/middleware/sharingSagas.test.js
, but still nested inside the maindescribe
block:describe("watching", () => { beforeEach(() => { Object.defineProperty(window, "location", { writable: true, value: { host: "test:1234", pathname: "/index.html", search...