Skip to content

Commit

Permalink
Merge branch 'master' into release-v8.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
khushal87 authored Feb 21, 2024
2 parents 142d91c + 0391fa0 commit 640dd6a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
15 changes: 0 additions & 15 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1237,10 +1237,6 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
event,
});

if (event.type === 'token.expiring' && !this.tokenManager.isStatic()) {
this.refreshToken();
}

if (event.type === 'user.presence.changed' || event.type === 'user.updated' || event.type === 'user.deleted') {
this._handleUserEvent(event);
}
Expand Down Expand Up @@ -3371,15 +3367,4 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
async commitMessage(id: string) {
return await this.post<APIResponse & MessageResponse>(this.baseURL + `/messages/${id}/commit`);
}

/**
* Calls the token provider to retrieve a new token
*
* This is an internal method, you only need to use it if, for some reason, the existing refresh logic of the client doesn't suit your needs.
*
*/
async refreshToken() {
const token = await this.tokenManager.loadToken();
return this.wsConnection?.refreshToken(token);
}
}
6 changes: 0 additions & 6 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,4 @@ export class StableWSConnection<StreamChatGenerics extends ExtendableGenerics =
}
}, this.connectionCheckTimeout);
};

refreshToken = (token: string) => {
// you can expect `token.ack` event if backend registered the new token for the WS connection
const d = JSON.stringify({ type: 'token.refresh', api_key: this.client.key, token });
this.ws?.send(d);
};
}
2 changes: 0 additions & 2 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export const EVENT_MAP = {
'user.updated': true,
'user.watching.start': true,
'user.watching.stop': true,
'token.expiring': true,
'token.ack': true,

// local events
'channels.queried': true,
Expand Down

0 comments on commit 640dd6a

Please sign in to comment.