Giter Club home page Giter Club logo

fcm-erlang's Introduction

fcm-erlang

This software provides an Erlang client for Firebase Cloud Messaging to enable notifications to

  • Browser
  • Android
  • iOS notifications

How to use with rebar3:

You can use fcm_app as a dependency in your rebar.config:

{deps , [
    {fcm, {git, "https://github.com/dong50252409/fcm-erlang", {branch, "master"}}}
]}.

Start FCM Service

Two connection types are supported.

  1. start_pool_with_api_key supports legacy api
  2. start_pool_with_json_service_file supports http v1 api

3> fcm:start_pool_with_api_key(foo, "google_console_server_key").
{ok,<0.60.0>}
4> fcm:start_pool_with_json_service_file(bar, "google_service_file_path.json").
{ok,<0.65.0>}

Stop Service

6> fcm:stop(foo).
6> fcm:stop(bar).

How to send a FCM message using from a specific FCM application:

At any time you can send a FCM message to one or more mobile devices by calling:

7> fcm:push(RegisteredName, RegIds, Message, Retry).

Where

* `RegistereName` is the atom used during registration
* `RegId` is Registration Id specified as Erlang binary (e.g., `<<"APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...">>`)
* `RegIds` is a list (max 1000 elements) of `RegId`	
* `Message` is an Erlang Map.
* `Retry` is only valid for legacy api.

In order to understand Message payload see Message Syntax. or Refer to HTTP v1

Credits

The project was inspired from pdincau/gcm-erlang. I would like to thank Paolo for the same.

fcm-erlang's People

Contributors

pankajsoni19 avatar dong50252409 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.