Coder Social home page Coder Social logo

aryaminus / rn-firechat-functions Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 4.39 MB

Serverless functions for push notification configuration of Rn-firechat for cloud messaging with subscription to database child 'chat' and then checking for the uid in 'friend' database to forward the push notification to the device token of receiver

License: MIT License

JavaScript 100.00%
firebase cloud-function-for-firebase serverless http-requests backend firebase-realtime-database firebase-cloud-messaging react react-native push-notifications

rn-firechat-functions's Introduction

RnFireChat-functions

RnFireChat-functions is the 5th session build for showing the implementation of Firebase for building a Chat app; both Chat Room and p2p along with serverless function for push notification which works in transition to this repository:

RN-firechat

RnFireChat demo

Installation

To use Functions, you need to install Firebase command line tools using npm so do install node.js Then, install Firebase CLI

$ npm install -g firebase-tools

Now, Clone the source locally:

$ git clone https://github.com/aryaminus/RN-firechat-functions
$ cd RN-firechat-functions

Install node modules:

$ cd functions
$ npm install

Login and deploy:

$ firebase login
$ firebase deploy --only functions:sendNotification

Else To initialize your project:

Run firebase login to log in via the browser and authenticate the firebase tool.
Go to your Firebase project directory.
Run firebase init functions. The tool gives you an option to install dependencies with npm. It is safe to decline if you want to manage dependencies in another way.

After these commands complete successfully, your project structure looks like this:

myproject
 +- .firebaserc    # Hidden file that helps you quickly switch between
 |                 # projects with `firebase use`
 |
 +- firebase.json  # Describes properties for your project
 |
 +- functions/     # Directory containing all your functions code
      |
      +- package.json  # npm package file describing your Cloud Functions code
      |
      +- index.js      # main source file for your Cloud Functions code
      |
      +- node_modules/ # directory where your dependencies (declared in
                       # package.json) are installed

Now, Clone the source locally:

$ git clone https://github.com/aryaminus/RN-firechat-functions
$ cd RN-firechat-functions

Then copy the files inside RN-firechat-functions/functions/index.js to myproject/functions/index.js

To deploy and execute:

$ firebase deploy --only functions:sendNotification

Additional Links:

  1. Firebase Cloud Functions
  2. Getting started with firebase functions
  3. CLI Docs

Contributing

  1. Fork it (https://github.com/aryaminus/RN-firechat-functions/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

rn-firechat-functions's People

Contributors

aryaminus avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.