Skip to content

Add GMPID header to the RTDB SDK #1610

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

Merged
merged 1 commit into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions firebase-database/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Unreleased

- [changed] Added internal HTTP header to the WebChannel connection.

# 19.3.0
- [feature] Added ServerValue.increment() to support atomic field value increments
without transactions.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class ConnectionContext {
private final boolean persistenceEnabled;
private final String clientSdkVersion;
private final String userAgent;
private final String applicationId;
private final String sslCacheDirectory;

public ConnectionContext(
Expand All @@ -33,13 +34,15 @@ public ConnectionContext(
boolean persistenceEnabled,
String clientSdkVersion,
String userAgent,
String applicationId,
String sslCacheDirectory) {
this.logger = logger;
this.authTokenProvider = authTokenProvider;
this.executorService = executorService;
this.persistenceEnabled = persistenceEnabled;
this.clientSdkVersion = clientSdkVersion;
this.userAgent = userAgent;
this.applicationId = applicationId;
this.sslCacheDirectory = sslCacheDirectory;
}

Expand Down Expand Up @@ -70,4 +73,8 @@ public String getUserAgent() {
public String getSslCacheDirectory() {
return sslCacheDirectory;
}

public String getApplicationId() {
return applicationId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ private WSClient createConnection(
host, hostInfo.isSecure(), hostInfo.getNamespace(), optLastSessionId);
Map<String, String> extraHeaders = new HashMap<String, String>();
extraHeaders.put("User-Agent", this.connectionContext.getUserAgent());
extraHeaders.put("X-Firebase-GMPID", this.connectionContext.getApplicationId());
WebSocket ws = new WebSocket(this.connectionContext, uri, /*protocol=*/ null, extraHeaders);
WSClientTubesock client = new WSClientTubesock(ws);
return client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public ConnectionContext getConnectionContext() {
this.isPersistenceEnabled(),
FirebaseDatabase.getSdkVersion(),
this.getUserAgent(),
firebaseApp.getOptions().getApplicationId(),
this.getSSLCacheDirectory().getAbsolutePath());
}

Expand Down