@@ -25,6 +25,7 @@ import { logWrapper, splitStringBySize } from '../core/util/util';
25
25
import { SDK_VERSION } from '../core/version' ;
26
26
27
27
import {
28
+ APPLICATION_ID_PARAM ,
28
29
APP_CHECK_TOKEN_PARAM ,
29
30
FORGE_DOMAIN_RE ,
30
31
FORGE_REF ,
@@ -99,7 +100,8 @@ export class WebSocketConnection implements Transport {
99
100
repoInfo ,
100
101
transportSessionId ,
101
102
lastSessionId ,
102
- appCheckToken
103
+ appCheckToken ,
104
+ applicationId
103
105
) ;
104
106
this . nodeAdmin = repoInfo . nodeAdmin ;
105
107
}
@@ -115,7 +117,8 @@ export class WebSocketConnection implements Transport {
115
117
repoInfo : RepoInfo ,
116
118
transportSessionId ?: string ,
117
119
lastSessionId ?: string ,
118
- appCheckToken ?: string
120
+ appCheckToken ?: string ,
121
+ applicationId ?: string
119
122
) : string {
120
123
const urlParams : { [ k : string ] : string } = { } ;
121
124
urlParams [ VERSION_PARAM ] = PROTOCOL_VERSION ;
@@ -137,6 +140,9 @@ export class WebSocketConnection implements Transport {
137
140
if ( appCheckToken ) {
138
141
urlParams [ APP_CHECK_TOKEN_PARAM ] = appCheckToken ;
139
142
}
143
+ if ( applicationId ) {
144
+ urlParams [ APPLICATION_ID_PARAM ] = applicationId ;
145
+ }
140
146
141
147
return repoInfoConnectionURL ( repoInfo , WEBSOCKET , urlParams ) ;
142
148
}
@@ -156,6 +162,7 @@ export class WebSocketConnection implements Transport {
156
162
PersistentStorage . set ( 'previous_websocket_failure' , true ) ;
157
163
158
164
try {
165
+ let options : { [ k : string ] : object } ;
159
166
if ( isNodeSdk ( ) ) {
160
167
const device = this . nodeAdmin ? 'AdminNode' : 'Node' ;
161
168
// UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
@@ -188,17 +195,8 @@ export class WebSocketConnection implements Transport {
188
195
if ( proxy ) {
189
196
options [ 'proxy' ] = { origin : proxy } ;
190
197
}
191
-
192
- this . mySock = new WebSocketImpl ( this . connURL , [ ] , options ) ;
193
- } else {
194
- const options : { [ k : string ] : object } = {
195
- headers : {
196
- 'X-Firebase-GMPID' : this . applicationId || '' ,
197
- 'X-Firebase-AppCheck' : this . appCheckToken || ''
198
- }
199
- } ;
200
- this . mySock = new WebSocketImpl ( this . connURL , [ ] , options ) ;
201
198
}
199
+ this . mySock = new WebSocketImpl ( this . connURL , [ ] , options ) ;
202
200
} catch ( e ) {
203
201
this . log_ ( 'Error instantiating WebSocket.' ) ;
204
202
const error = e . message || e . data ;
0 commit comments