A client library for a chat server to be used in React Native training
Takes a single parameter with three properties: channel name, sender name and a message text. Returns a Promise.
import { send } from 'react-native-training-chat-server';
send({
channel: "ChannelName",
sender: "Your Name",
message: "Anything you'd like to say"
});
Callback is called every time new messages arrive to chat
import { subscribe } from 'react-native-training-chat-server';
subscribe("ChannelName", messages => {
messages.forEach(message => {
console.log(`${message.sender}: ${message.message}`);
})
});