Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
openStream(
rpcName: string,
token: Token | null
): Stream {
const urlParts = [
this.baseUrl,
'/',
RPC_STREAM_SERVICE,
'/',
rpcName,
'/channel'
];
const webchannelTransport = createWebChannelTransport();
const request: WebChannelOptions = {
// Background channel test avoids the initial two test calls and decreases
// initial cold start time.
// TODO(dimond): wenboz@ mentioned this might affect use with proxies and
// we should monitor closely for any reports.
backgroundChannelTest: true,
// Required for backend stickiness, routing behavior is based on this
// parameter.
httpSessionIdParam: 'gsessionid',
initMessageHeaders: {},
messageUrlParams: {
// This param is used to improve routing and project isolation by the
// backend and must be included in every request.
database: `projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`
},
sendRawJson: true,