Hey guys :)
I have a small problem when trying to put info on a channel like this yield put(infoChannel, data).
infoChannel is a generic channel from redux-saga.
data is just an object.
I was reading the docs of redux-saga and at the end of this page there is an example of yield put(<channel>, <Object>) and I tried it with reactotron, but apparently it somehow blocks the display of the details of the saga that executes this.
Am I doing something wrong?
Thanks!
I have yet to build in channel support. The harsh truth is... i don't understand them. Haha.
I'll take another look at them and build in the support needed.
More curious than anything here... how are you using them? Do you get good mileage out of them?
@skellock can't provide the specific example that I use it for but channels are useful for when communicating with an external source that can have events (like socket.io). I suspect there are a lot more use cases as well. For a quick and dirty example:
You create a eventChannel which you setup your communication with the socket.io server and wire up events to put payloads on the emitter that is provided to you by the eventChannel. Outside of that event channel you take the channel which resolves everytime you put a payload on the channel. Some pseudo code:
const chan = new eventChannel((emitter) => {
console.log('Connect to your server...');
const randomServer = {...}
randomServer.on('superAwesomeEvent', (data) => {
emitter(data);
});
return () => {
console.log('Shut down the server, cleanup, etc');
}
});
while (true) {
const evt = yield take(chan);
console.log('Do sweet things with your payload');
}
@skellock sorry for the late response....
I found a workaround, now I'm using just a generic channel and appears to be working well. But still is a bit weird for other channels.
No plans to build this, so I'll close. I wouldn't say no if someone did!