PubNub ChatEngine is an object oriented event emitter based framework for building chat applications in Javascript. It reduces the time to build chat applications drastically and provides essential components like typing indicators, online presence monitoring and message history out of the box.
The real time server component is provided by PubNub. ChatEngine is designed to be extensible and includes a plugin framework to make adding new features simple.
ChatEngine is compiled with babel and supports these browsers and create-react-app.
Check out the getting started guide.
You can find the full docs on the full documentation website. Concepts are linked below for convenience.
- Me - It's you dummy. The user that represents the current application.
- Users and State - Explains how to interact with other users using ChatEngine and get additional information about them.
- Chats - ChatEngine's bread and butter. These are isolated rooms that users can talk to each other in.
- Events - Events are things that happen in a chat. Like
message
orimage_upload
for example. - Event Payload - The data that comes with an event. Includes things like who sent the event and what chat it was sent to.
- Namespaces - ChatEngine has a lot of events, so we use name spacing to isolate them.
- Wildcards - Get all the events of a single namespace, like $.online.* to get all types of online events.
- Search - Retrieve old events that happened in the past. Usually done when your application boots up to show what happened before.
- Global Chat - The chat that all users connect to. It's used for state management and application wide events.
- Online List - Get all the users online in the chat room.
- Authentication - How to use auth keys to identify your users and protect access to channels.
- Privacy - Every user has a special feed chat that only they can publish to, and a direct chat that nobody else can read from. Outlines other ways of handling permissions as well.
- Private Chats - Create private chats that nobody else can join.
- Templating - How ChatEngine works with other frameworks like React, Angular, jQuery, and plain ol' Javascript.
- Errors - Sometimes things don't go as planned, here's how you can catch errors gracefully.
- Debugging - How to use the built-in utilities for logging events and network requests.
- Plugins - Drop in extra functionality, like emojii or typing indicators with plugins.
- Building a Plugin - If what you need doesn't exist, it's easy to build yourself. Share it with us!
- PubNub Functions - ChatEngine uses PubNub functions as a server component and details about that can be found here.
- PubNub Channel Topology - Describes what PubNub channels ChatEngine is using under the hood.
- Chat - Really simple chat example. The "hello world" of ChatEngine.
- Online List - No chats, just renders who is online. See the Kitchen Sinks for how to combine this with private chats.
- React Native Example - Made with
create-react-app
. - React Native Components - Premade components for rendering Chats, Messages, Users, and more.
- Integrating into an existing iOS App - Guide on adding ChatEngine React native app into iOS.
- Integrating into an existing Android App - Guide on adding ChatEngine React Native app in Android.
- React - Bare bones react web example.
- Vue Guide - Guide on using ChatEngine and Vue together. Uses the following resources.
- Vue Example - Full featured ChatEngine vue example.
- Vue Plugin - ChatEngine plugin for vue.
- Angular Simple - Angular "Hello World" app. Simple app that uses a custom Angular plugin to render when anything updates.
- Angular Kitchen Sink - The largest demo app out there, almost a complete Desktop Team Chat clone (Slack, Stride, Flowdock). Persistent URLS and renders into a real desktop app with Electron!
- jQuery Simple - jQuery ChatEngine "Hello World" app. Simple app where everyone chats together.
- jQuery Kitchen Sink - Huge example that uses most ChatEngine features. Has an online list that spawns new chats when you click on usernames.
- Facebook Login - Use Facebook Profiles with ChatEngine.
- NodeJS ChatBot - An example bot that responds to messages and emulates typing. Works with the jQuery Kitchen Sink example by default.
- Build smart chat apps with Amazon machine learning APIs and the PubNub ChatEngine
- ChatEngine vs iMessage Benchmark
- Chat Landscape
- Building a Dating App Overview
- The integration tests in
test/integration
includes some usage examples.
Check out the jQuery Kitchen Sink and Angular Kitchen Sink examples to see plugins in action.
Uses UploadCare service to uplaod images and render them in chats. Example.
Render Markdown in HTML when receiving messages. Example.
Allows the current user to stop receiving events from other users. Example.
A simple way to search through the list of users online in the chat. Example.
Provides convenience methods that fire when a user starts or stops typing. Example
Allows you to mark a chat as being in the background and increments a counter as events are sent to it. Example.
Uses HTML5 Notification API to send "toaster" updates.
Uses images as fallback for devices that might not yet support 💩.
Emits additional events when someone reads a receives and/or reads a message.
Uses Gravatar service to create an avatar based on user state information.
A plugin that gives every use a random username combining a color and an animal.
Clone repos (chat-engine and plugins).
All repos should be siblings of one another. This is required for rendering docs properly.
chat-engine
chat-engine-desktop-notifications
chat-engine-emoji
chat-engine-examples
//...
nvm use v6
run http-server
from my /development
directory which has all chat-engine repos:
cd chat-engine
node server.js
load http://localhost:8080 in browser and navigate to /chat-engine-examples/jquery/kitchen-sink
Run gulp
to compile, but you should probably run gulp watch
to get consistent changes.
You will need to assign environment variables PUB_KEY_0
and SUB_KEY_0
to your own PubNub keys. Add these variables into your .bashrc
or .zshrc
.
# pubnub chatengine keys
export PUB_KEY_0="YOUR PUBNUB PUBLISH KEY"
export SUB_KEY_0="YOUR PUBNUB SUBSCRIBE KEY"
Then, in the root folder run:
gulp test
You can find the scripts for the PubNub Automagic Setup here: https://github.com/pubnub/chat-engine-setup.
npm version patch && git push origin master --tags