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
describeblock at the bottom oftest/middleware/sharingSagas.test.js, but still nested inside the maindescribeblock:describe("watching", () => { Â Â beforeEach(() => { Â Â Â Â Object.defineProperty(window, "location", { Â Â Â Â Â Â writable: true, Â Â Â Â Â Â value: { Â Â Â Â Â Â Â Â host: "test:1234", Â Â Â Â Â Â Â Â pathname: "/index.html", Â Â Â Â Â Â Â Â search...