Skip to content

Commit

Permalink
fix: set SDK header before sending first request
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Jun 21, 2024
1 parent 95733f8 commit 7c3b740
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions projects/stream-chat-angular/src/lib/chat-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ export class ChatClientService<
this.trackPendingChannelInvites =
clientOptions?.trackPendingChannelInvites === true;
this.chatClient = StreamChat.getInstance<T>(apiKey, clientOptions);
const sdkPrefix = 'stream-chat-angular';
if (!this.chatClient.getUserAgent().includes(sdkPrefix)) {
this.chatClient.setUserAgent(
`${sdkPrefix}-${version}-${this.chatClient.getUserAgent()}`
);
}
this.chatClient.recoverStateOnReconnect = false;
this.chatClient.devToken;
let result;
Expand All @@ -129,12 +135,6 @@ export class ChatClientService<
this.userSubject.next(
this.chatClient.user ? { ...this.chatClient.user } : undefined
);
const sdkPrefix = 'stream-chat-angular';
if (!this.chatClient.getUserAgent().includes(sdkPrefix)) {
this.chatClient.setUserAgent(
`${sdkPrefix}-${version}-${this.chatClient.getUserAgent()}`
);
}
});
if (this.chatClient.user?.id && this.trackPendingChannelInvites) {
const channels = await this.chatClient.queryChannels(
Expand Down

0 comments on commit 7c3b740

Please sign in to comment.