Skip to content

Commit

Permalink
Merge pull request #37 from DataDog/wes.auyeung/conform-handshake-tim…
Browse files Browse the repository at this point in the history
…eout

[UI Apps] Conform FramePost client handshake timeout to ParentClient in web-ui
  • Loading branch information
wfa207 committed Apr 26, 2021
2 parents 354c234 + 2c430fe commit f2ae79a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/client/client.ts
Expand Up @@ -2,7 +2,7 @@ import { ChildClient } from '@datadog/framepost';

import { DDAPIClient } from '../api/api';
import { DDAuthClient } from '../auth/auth';
import { UiAppEventType, Host } from '../constants';
import { UiAppEventType, Host, FramePostClientSettings } from '../constants';
import { DDDashboardCogMenuClient } from '../dashboard-cog-menu/dashboard-cog-menu';
import { DDDashboardClient } from '../dashboard/dashboard';
import { DDEventsClient } from '../events/events';
Expand Down Expand Up @@ -55,7 +55,8 @@ export class DDClient {
}

this.framePostClient = new ChildClient<Context>({
debug: false, // 3p devs most likely dont need to see framepost debug messages
debug: FramePostClientSettings.DEBUG,
requestTimeout: FramePostClientSettings.CLIENT_REQUEST_TIMEOUT,
profile: this.debug,
context: {
sdkVersion: SDK_VERSION,
Expand Down
8 changes: 8 additions & 0 deletions src/constants.ts
Expand Up @@ -46,6 +46,14 @@ export enum IFrameApiRequestMethod {
DELETE = 'DELETE'
}

export const FramePostClientSettings = Object.freeze({
// 3p devs most likely dont need to see framepost debug messages
DEBUG: false,
// TODO: Revisit approach; the 10s is to unblock 3p devs
// Must match server-side constant
CLIENT_REQUEST_TIMEOUT: 10000
});

// "Requests" are distinct from events in that the sdk client expects a response
// from the frameManager, or vice-versa. This is useful when the child frames
// ask the parent frames to perform an operation.
Expand Down

0 comments on commit f2ae79a

Please sign in to comment.