2.0.0 • Published 6 years ago

react-native-training-chat-server v2.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

react-native-training-chat-server

A client library for a chat server to be used in React Native training

API

send({ channelName, sender, message })

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"
});

subscribe(channelName, callback)

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}`);
  })
});
2.0.0

6 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago