Breedr Messaging

Installation
To install the latest version run:
yarn add @breedr/messaging
or
npm install --save @breedr/messaging
Usage
initMessaging()
It is a Promise function to initialize Breedr Messaging
.
await initMessaging({
userInfo, // backend `User` type, result of `userInfo` query
apolloClient,
appId: env.SEND_BIRD_APP_ID,
})
It makes the Messaging context available to the rest of your app:
.
render() {
return (
<Provider store={store}>
<ApolloProvider client={apolloClient}>
<MessagingProvider>
<App />
</MessagingProvider>
</ApolloProvider>
</Provider>
);
}
connectMessaging()
It is a HOC to connect your component to the Messaging context.
.
export default compose(
connectMessaging((messaging) => ({
channels: messaging.getGroupChannels(),
unreadMessagesCount: messaging.getUnreadGroupMessagesCount(),
refresh: messaging.refreshChannels,
})),
lifecycle({
componentDidMount() {
this.props.refresh();
},
}),
)(Channels);