项目作者: pankajsoni19

项目描述 :
Firebase Cloud Messaging V1 API
高级语言: Erlang
项目地址: git://github.com/pankajsoni19/fcm-erlang.git
创建时间: 2016-07-21T08:56:57Z
项目社区:https://github.com/pankajsoni19/fcm-erlang

开源协议:MIT License

下载


fcm-erlang

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

  • Browser
  • Android
  • iOS notifications

Changelog

1.1.0 [ 10 June 2020 ]

  • Added support for firebase http v1 cloud messaging.

1.0.1

  • Remove qdate dependency

1.0.0

  • Initial Release

How to compile:

fcm-erlang uses erlang.mk as make system. To compile

  1. $ make

To generate release

  1. $ make rel

How to use with rebar:

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

  1. {deps , [
  2. {fcm, ".*", {git, "https://github.com/pankajsoni19/fcm-erlang.git", {tag, "1.1.0"}}}
  3. ]}.

How to run the application fcm-erlang:

make rel will create a release under _rel/fcm directory.

  1. $ cd _rel/fcm
  2. $ bin/fcm console

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
  1. 3> fcm:start_pool_with_api_key(foo, "google_console_server_key").
  2. {ok,<0.60.0>}
  3. 4> fcm:start_pool_with_json_service_file(bar, "google_service_file_path.json").
  4. {ok,<0.65.0>}

Stop Service

  1. 6> fcm:stop(foo).
  2. 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:

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

Where

  1. * `RegistereName` is the atom used during registration
  2. * `RegId` is Registration Id specified as Erlang binary (e.g., `<<"APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...">>`)
  3. * `RegIds` is a list (max 1000 elements) of `RegId` * `Message` is an Erlang Map.
  4. * `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.