Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Adds the ability to show "Ian Jennings is typing..." to a chatroom easily.

License

Notifications You must be signed in to change notification settings

pubnub/chat-engine-typing-indicator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository is a part of the ChatEngine Framework. For more information on building chat applications with PubNub, see our Chat Resource Center.

Typing Indicator Plugin for ChatEngine

Adds the ability to show a typing indicator on a ChatEngine Chat

Quick Start

  1. Have a ChatEngine server running already, instantiate a client and connect it
const ChatEngine = ChatEngineCore.create({
    publishKey: 'pub-key-here',
    subscribeKey: 'sub-key-here'
});

ChatEngine.connect('Username');
ChatEngine.on('$ready', () = { ... });
  1. Attach this plugin to the channel you want, in this case global
ChatEngine.global.plugin(ChatEngineCore.plugin['chat-engine-typing-indicator']());
  1. The plugin needs to be notified when the user is considered typing or not typing
// emits the $typingIndicator.startTyping event
ChatEngine.global.typingIndicator.startTyping();
// emits the $typingIndicator.stopTyping even - default state
ChatEngine.global.typingIndicator.stopTyping();
  1. Listen for the events
ChatEngine.global.on('$typingIndicator.startTyping', (payload) => {
    console.log(payload.user + "is typing...");
});
ChatEngine.global.on('$typingIndicator.stopTyping', (payload) => {
    console.log(payload.user + "is not typing.");
});

Support

  • If you need help, have a general question, have a feature request or to file a bug, contact [email protected].