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

@nezam/firebase-chat-manager

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nezam/firebase-chat-manager

Nodejs helper to manage firebase realtime database for chatting rooms

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Firebase Chat Manager

A small library that manages firebase realtime database for API use as a Chat Interface.

Installation

npm install @abdullaalsayyed/firebase-chat-manager

Usage

Initialization:

var Chat = require('@abdullaalsayyed/firebase-chat-manager');

Chat.configurations = {
                          apiKey: "<your-api-key>",
                          authDomain: "<project-id>.firebaseapp.com",
                          databaseURL: "https://<project-id>.firebaseio.com",
                          projectId: "<project-id>",
                          storageBucket: "<project-id>.appspot.com",
                          messagingSenderId: "<sender-id>",
                          namespace: '<your-custom-namepace>',
                          timestampFormat: 'YYYY/MM/DD HH:mm:ss'
                      };

Create new chat:

var chat = new Chat(123);
 
// If there is no chat created with that id, it will return that chat object or it will create a new instance.
var chat = Chat.findOrCreate({chatId: 2225, senderId: 2222, receiverId: 3333});

Get Chat Messages:

chat.getMessages().then((message) => { console.log(message.val()) });  
        

Send a new Message:

chat.sendMessage({text: 'new message', senderId: 22551});

Delete all chat messages:

chat.clearMessages();

Tests

npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Keywords

FAQs

Package last updated on 21 Oct 2018

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