-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
topic subscriptions #6
Comments
@tugorez But there is api for manage relaationship maps in FCM. I'm planning to implement this by fcmex in next version! |
Topic subscription added in fcmex 0.2.0. def deps do
[{:fcmex, "~> 0.2.0"}]
end Usage# create a subscription
{:ok, result} = Fcmex.Subscription.subscribe("topic_name", "fcm_token")
# get subscription information related with specified token
{:ok, result} = Fcmex.Subscription.get("fcm_token")
iex> result
%{
"application" => "application_name",
"applicationVersion" => "3.6.1",
"authorizedEntity" => "1234567890",
"platform" => "IOS",
"rel" => %{"topics" => %{"test_topic" => %{"addDate" => "2018-05-03"}}},
"scope" => "*"
}}
# create multiple subscriptions
{:ok, result} = Fcmex.Subscription.subscribe("topic_name", ["fcm_token", "fcm_token2"])
# unsubscribe a topic
{:ok, result} = Fcmex.Subscription.unsubscribe("topic_name", "fcm_token")
# batch unsubscribe from a topic
{:ok, result} = Fcmex.Subscription.unsubscribe("topic_name", ["fcm_token", "fcm_token2"]) push to the topic {:ok, body} = Fcmex.push("/topics/topic_name",
notification: %{
title: "foo",
body: "bar",
click_action: "open_foo",
icon: "new",
}
) |
OMG it was really fast :) thank you very much for your help @shufo |
Is it possible with the current api to subscribe users to a topic?
The text was updated successfully, but these errors were encountered: