messaging.channel()
Returns a redux-saga Channel which emits for every message received.
A redux-saga Channel which emits for every message received.
function* readMessages() {
const channel = rsf.messaging.channel();
while(true) {
const message = yield take(channel);
yield put(showMessage(message));
}
}
messaging.syncMessages(options)
Automatically dispatches a redux action every time a new message is received.
Type | Description | |
---|---|---|
options Optional | Object | An object to configure how the messages should be synchronised. It must contain at least the |
import { showMessage } from '../actionCreators/messaging';
function* notificationsRootSaga() {
yield fork(
rsf.messaging.syncMessages,
{ successActionCreator: showMessage }
);
}
messaging.syncToken(options)
Automatically dispatches a redux action every time a new registration token is received.
Type | Description | |
---|---|---|
options Optional | Object | An object to configure how the token should be synchronised. It must contain at least the |
import { setToken } from '../actionCreators/messaging';
function* notificationsRootSaga() {
yield fork(
rsf.messaging.syncToken,
{ successActionCreator: setToken }
);
}
messaging.tokenRefreshChannel()
Returns a redux-saga Channel which emits every time the registration token is refreshed.
A redux-saga Channel which emits every time the registration token is refreshed.
function* refreshToken() {
const channel = rsf.messaging.tokenRefreshChannel();
while(true) {
const token = yield take(channel);
yield put(setToken(token));
}
}