Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chat-engine-mute

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chat-engine-mute

Adds the ability to count unread messages in a ChatEngine Chat

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Unread Messages Plugin

Adds the ability to count unread messages in a ChatEngine Chat

Quick Start

  1. Have ChatEngine instantiated and connected, and have a channel you want to count unread messages on
const ChatEngine = ChatEngineCore.create({
    publishKey: 'pub-key-here',
    subscribeKey: 'sub-key-here',
}, {
    endpoint: 'http://chatengine:server/',
    globalChannel: 'global-channel-name'
});

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-unread-messages']());
  1. The plugin needs to be notified when the user is considered active or inactive to properly count messages
// sets unreadCount to 0, stops counting unread messages and stops emitting events
ChatEngine.global.unreadMessages.active();
// starts counting unread messages and starts emitting events - default state
ChatEngine.global.unreadMessages.inactive();
  1. Listen for the $unread events that emit whenever your channel recieves a message while it is marked as inactive
ChatEngine.global.on('$unread', () => {
    console.log(ChatEngine.global.unreadCount);
});

FAQs

Package last updated on 09 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc