Provides social network style messaging between users.
This is a Meteor package with part of it's code published as a companion NPM package made to work with React Native. This allows your Meteor and React Native projects that use this package to share code between them to give you a competitive advantage when bringing your mobile and web application to market.
In the spirit of keeping this and all of the packages in the Socialize set alive, I ask that if you find this package useful, please donate to it's development.
- Multi User Conversations
- Read Status - has the participating user viewed the conversation since the last message was sent.
- Typing Status - Is the participating user typing.
- Observing Status - Is the participating user viewing the conversation.
- Flight Status - Has the message reached the server and been saved to the database yet.
This package relies on the npm package simpl-schema
so you will need to make sure it is installed as well.
$ meteor npm install --save simpl-schema
$ meteor add socialize:messaging
When using this package with React Native, the dependency tree ensures that simpl-schema
is loaded so there's no need to install it as when using within Meteor.
$ npm install --save @socialize/messaging
Note
When using with React Native, you'll need to connect to a server which hosts the server side Meteor code for your app using
Meteor.connect
as per the @socialize/react-native-meteor documentation.
Depending on the environment your code will be running in, you'll need to import the classes from the packages specific to that environment, either Meteor or React Native.
// Meteor Imports
import { Meteor } from 'meteor/meteor';
import { Conversation } from 'meteor/socialize:messaging';
// React Native Imports
import Meteor from '@socialize/react-native-meteor';
import { Conversation } from '@socialize/messaging';
Once we have the appropriate packages imported, the rest of the code will run in either environment.
let convo = new Conversation.save();
let otherUser = Meteor.users.findOne();
convo.addParticipant(otherUser);
convo.sendMessage("Hey, What's up?")
For a more in depth explanation of how to use this package see API.md
This implements cultofcoders:redis-oplog's namespaces to provide reactive scalability as an alternative to Meteor's livedata
. Use of redis-oplog is not required and will not engage until you install the cultofcoders:redis-oplog package and configure it.