-
Notifications
You must be signed in to change notification settings - Fork 273
chore(snippets): updated code samples to use ADC and supported APIs #752
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -129,7 +129,7 @@ func sendAll(ctx context.Context, client *messaging.Client) { | |||||
| }, | ||||||
| } | ||||||
|
|
||||||
| br, err := client.SendAll(context.Background(), messages) | ||||||
| br, err := client.SendEach(context.Background(), messages) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this change, the |
||||||
| if err != nil { | ||||||
| log.Fatalln(err) | ||||||
| } | ||||||
|
|
@@ -191,7 +191,7 @@ func sendMulticast(ctx context.Context, client *messaging.Client) { | |||||
| Tokens: registrationTokens, | ||||||
| } | ||||||
|
|
||||||
| br, err := client.SendMulticast(context.Background(), message) | ||||||
| br, err := client.SendEachForMulticast(context.Background(), message) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function receives a
Suggested change
|
||||||
| if err != nil { | ||||||
| log.Fatalln(err) | ||||||
| } | ||||||
|
|
@@ -219,7 +219,7 @@ func sendMulticastAndHandleErrors(ctx context.Context, client *messaging.Client) | |||||
| Tokens: registrationTokens, | ||||||
| } | ||||||
|
|
||||||
| br, err := client.SendMulticast(context.Background(), message) | ||||||
| br, err := client.SendEachForMulticast(context.Background(), message) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function receives a
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this change, the |
||||||
| if err != nil { | ||||||
| log.Fatalln(err) | ||||||
| } | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function receives a
ctx context.Contextparameter, butcontext.Background()is used here. To allow for proper context propagation (for cancellation, deadlines, tracing, etc.), you should use thectxvariable that is passed into the function.