Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b53c94f
Preliminary impl of FCM batch support
hiranya911 Jan 29, 2019
6882354
Added BatchMessage class and tests
hiranya911 Jan 29, 2019
e75bcff
Refactored the FCM send operation
hiranya911 Jan 29, 2019
726ee09
Added unit tests for sendBatch() API
hiranya911 Jan 29, 2019
e3ad436
Refactored error handling
hiranya911 Jan 29, 2019
504e9ef
Refactored FCM logic into a new FirebaseMessagingClient class
hiranya911 Jan 30, 2019
80ed4b1
Using a separate request factory for child requests
hiranya911 Jan 30, 2019
057fcb5
Added the InstanceIdClient class for handling topic mgt ops
hiranya911 Jan 30, 2019
2c36d4c
Added license headers
hiranya911 Jan 30, 2019
c437042
Renamed BatchResponse as SendResponse
hiranya911 Jan 30, 2019
a3223fd
Added BatchResponse class; Renamed BatchMessage to MulticastMessage
hiranya911 Feb 6, 2019
5668421
Updated tests and docs
hiranya911 Feb 6, 2019
693711f
Updated documentation
hiranya911 Feb 6, 2019
46507d8
Added documentation and tests
hiranya911 Feb 6, 2019
b4d80e0
Merge branch 'master' into hkj-fcm-batch
hiranya911 Feb 6, 2019
0371159
Updated docs, changelog and annotations
hiranya911 Feb 6, 2019
5d57e07
Updated integration test to use multiple topics; Updated docs
hiranya911 Feb 7, 2019
f8f8c1e
Removing a redundant whitespace
hiranya911 Feb 11, 2019
7ecabe0
Reduced FCM batch size to 100 (#250)
hiranya911 Feb 19, 2019
3c0ae40
Setting the X-Client-Version header for FCM (#252)
hiranya911 Feb 22, 2019
c6367c0
Snippets for FCM sendAll() and sendMulticast() (#249)
hiranya911 Feb 25, 2019
1fbddcb
Addressing some documentation nits
hiranya911 Mar 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added license headers
  • Loading branch information
hiranya911 committed Jan 30, 2019
commit 2c36d4cd76cdc22ce13a95b247e40b6af2b17bd0
16 changes: 16 additions & 0 deletions src/main/java/com/google/firebase/internal/ApiClientUtils.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2019 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.firebase.internal;

import com.google.api.client.http.HttpRequestFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private BatchRequest newBatchRequest(
final GenericUrl sendUrl = new GenericUrl(fcmSendUrl);
for (Message message : messages) {
// Using a separate request factory without authorization is faster for large batches.
// A simple perf test showed a 400-500ms speed up for batches of 1000 messages.
// A simple performance test showed a 400-500ms speed up for batches of 1000 messages.
HttpRequest request = childRequestFactory.buildPostRequest(
sendUrl,
new JsonHttpContent(jsonFactory, message.wrapForTransport(dryRun)));
Expand All @@ -182,6 +182,7 @@ private FirebaseMessagingException createExceptionFromResponse(HttpResponseExcep
// ignored
}
}

return newException(response, e);
}

Expand All @@ -205,6 +206,7 @@ private static FirebaseMessagingException newException(
if (code == null) {
code = UNKNOWN_ERROR;
}

String msg = response.getErrorMessage();
if (Strings.isNullOrEmpty(msg)) {
if (e != null) {
Expand All @@ -214,6 +216,7 @@ private static FirebaseMessagingException newException(
msg = String.format("Unexpected HTTP response: %s", response.toString());
}
}

return new FirebaseMessagingException(code, msg, e);
}

Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/google/firebase/messaging/InstanceIdClient.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2019 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.firebase.messaging;

import com.google.api.client.http.GenericUrl;
Expand Down