Open p3lli opened 6 years ago
Hello and thank you for developing this package.
I was trying to use Topic Subscription and Topic Notification, but I'm having some difficulties.
When I try to subscribe a token to a topic, fmt.Printf("Firebase response is: %v", response) returns Firebase response is: &{ [map[]] 200 OK 200}.
fmt.Printf("Firebase response is: %v", response)
Firebase response is: &{ [map[]] 200 OK 200}
When then I try to send a message to that topic, response is {true 200 0 0 0 0 [] NUMERIC_CODE }.
response
{true 200 0 0 0 0 [] NUMERIC_CODE }
It seems like I have messed up something in the subscription, but I don't know what.
// subscription snippet package subscription apiKey := "API_KEY" topics := []string{"/topics/t1", "/topics/t2"} tokens := []string{"token1", "token2", "token3"} client := fcm.NewFcmClient(apiKey) for _, topic := range topics { response, err := client.BatchSubscribeToTopic(tokens, topic) if err != nil { // log err } } // sending snippet package sending apiKey := "API_KEY" payload := &fcm.NotificationPayload{ Title: "title" Body: "body" } client = fcm.NewFcmClient(apiKey) client.SetNotificationPayload(payload) data := map[string]string{ "source": "source", "category": "category", } topics := []string{"/topics/t1", "/topics/t2"} for _, topic := range topics { client.NewFcmMsgTo(topic, data) } status, err := client.Send() if err != nil { // log err }
If I try to send the same message using NewFcmRegIdsMsg it works
NewFcmRegIdsMsg
// sending snippet package sending apiKey := "API_KEY" payload := &fcm.NotificationPayload{ Title: "title" Body: "body" } client = fcm.NewFcmClient(apiKey) client.SetNotificationPayload(payload) data := map[string]string{ "source": "source", "category": "category", } tokens := []string{"token1", "token2", "token3"} client.NewFcmRegIdsMsg(tokens, data) status, err := client.Send() if err != nil { // log err }
Thank you for your attention
Hello, is there any information related to this issue? currently i'm facing the same problem
Hello and thank you for developing this package.
I was trying to use Topic Subscription and Topic Notification, but I'm having some difficulties.
When I try to subscribe a token to a topic,
fmt.Printf("Firebase response is: %v", response)
returnsFirebase response is: &{ [map[]] 200 OK 200}
.When then I try to send a message to that topic,
response
is{true 200 0 0 0 0 [] NUMERIC_CODE }
.It seems like I have messed up something in the subscription, but I don't know what.
If I try to send the same message using
NewFcmRegIdsMsg
it worksThank you for your attention