# firebase-chat-manager

> Nodejs helper to manage firebase realtime database for chatting rooms

Latest version **1.0.1** (published 2018-10-20) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install firebase-chat-manager
pnpm add firebase-chat-manager
yarn add firebase-chat-manager
bun add firebase-chat-manager
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-10-20 |
| First published | 2018-10-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | abdullaalsayyed |
| Maintainers | abdullaalsayyed |

## Links

- npm: https://www.npmjs.com/package/firebase-chat-manager
- Repository: https://gitlab.com/abdullaalsayyed/firestore-chat-manager
- Homepage: https://gitlab.com/abdullaalsayyed/firestore-chat-manager#README
- Issues: https://gitlab.com/abdullaalsayyed/firestore-chat-manager/issues
- npm.io page: https://npm.io/package/firebase-chat-manager

## Dependencies (2)

- [firebase](https://npm.io/package/firebase.md) ^5.5.4
- [time-stamp](https://npm.io/package/time-stamp.md) ^2.1.0

## Recent versions

- 1.0.1 (latest) — 2018-10-20
- 1.0.0 — 2018-10-15

## README

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 = const config = {
                              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.
    Chat.findOrCreate({chatId: 2225, senderId: 2222, receiverId: 3333});
  
Get Chat Messages: 

    chat.getMessages().then(function (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.

---
_Source: https://npm.io/package/firebase-chat-manager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
