Skip to content

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

Notifications You must be signed in to change notification settings

jevakallio/react-native-training-chat-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages