Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #118 from mercari/replace-gcm-fcm-in-doc
Browse files Browse the repository at this point in the history
doc: replaced GCM to FCM.
  • Loading branch information
cubicdaiya authored Jun 10, 2019
2 parents 825f167 + 6befa83 commit 5efe250
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions gcm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const (
// maxRegistrationIDs are max number of registration IDs in one message.
maxRegistrationIDs = 1000

// maxTimeToLive is max time GCM storage can store messages when the device is offline
// maxTimeToLive is max time FCM storage can store messages when the device is offline
maxTimeToLive = 2419200 // 4 weeks
)

// Client abstracts the interaction between the application server and the
// GCM server. The developer must obtain an API key from the Google APIs
// FCM server. The developer must obtain an API key from the Google APIs
// Console page and pass it to the Client so that it can perform authorized
// requests on the application server's behalf. To send a message to one or
// more devices use the Client's Send methods.
Expand All @@ -39,7 +39,7 @@ type Client struct {
// If you need our own configuration overwrite it.
func NewClient(urlString, apiKey string) (*Client, error) {
if len(urlString) == 0 {
return nil, fmt.Errorf("missing GCM/FCM endpoint url")
return nil, fmt.Errorf("missing FCM endpoint url")
}

if len(apiKey) == 0 {
Expand All @@ -57,7 +57,7 @@ func NewClient(urlString, apiKey string) (*Client, error) {
}, nil
}

// Send sends a message to the GCM server without retrying in case of
// Send sends a message to the FCM server without retrying in case of
// service unavailability. A non-nil error is returned if a non-recoverable
// error occurs (i.e. if the response status is not "200 OK").
func (c *Client) Send(msg *Message) (*Response, error) {
Expand Down
2 changes: 1 addition & 1 deletion gcm/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func startTestServer(t *testing.T, resp *testResponse) *httptest.Server {

func TestNewClient(t *testing.T) {
if _, err := NewClient("", ""); err == nil {
t.Fatalf("expect to be faied (missing GCM/FCM endpoint)")
t.Fatalf("expect to be faied (missing FCM endpoint)")
}

if _, err := NewClient(FCMSendEndpoint, ""); err == nil {
Expand Down
4 changes: 2 additions & 2 deletions gcm/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
)

// Message is used by the application server to send a message to
// the GCM server. See the documentation for GCM Architectural
// the FCM server. See the documentation for FCM Architectural
// Overview for more information:
// http://developer.android.com/google/gcm/gcm.html#send-msg
// https://firebase.google.com/docs/cloud-messaging/http-server-ref
type Message struct {
RegistrationIDs []string `json:"registration_ids"`
CollapseKey string `json:"collapse_key,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions gcm/response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package gcm

// Response represents the GCM server's response to the application
// server's sent message. See the documentation for GCM Architectural
// Response represents the FCM server's response to the application
// server's sent message. See the documentation for FCM Architectural
// Overview for more information:
// http://developer.android.com/google/gcm/gcm.html#send-msg
// https://firebase.google.com/docs/cloud-messaging/http-server-ref
type Response struct {
MulticastID int64 `json:"multicast_id"`
CanonicalIDs int `json:"canonical_ids"`
Expand Down

0 comments on commit 5efe250

Please sign in to comment.