8000 GitHub - SysVisionINT/fcm: Firebase Cloud Messaging
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SysVisionINT/fcm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fcm

Firebase Cloud Messaging

fcm

Firebase Cloud Messaging server HTTP v1 protocol Erlang implementation

Installation

Using rebar3:

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

Setup fcm

After starting fcm, the setup function must be called, before messages can be sent.

#!erlang
fcm:setup(ProjectId :: binary(), ClientEmail :: binary(), RsaPrivateKey :: binary()) -> ok | invalid_key.

The RsaPrivateKey must be in the "RSA PRIVATE KEY" format. To convert the key provided by Google use:

openssl rsa -in server.key -out server_new.key

Sending a message

In order to send a message, first include the fcm.hrl file:

#!erlang
-include_lib("fcm/include/fcm.hrl").

Create a #fcm_message{} according to the Firebase Cloud Messaging message specification, and use the send function.

#!erlang
fcm:send(Message :: #fcm_message{}) -> ok | error.

About

Firebase Cloud Messaging

Resources

509F

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0