message: Move join session out of getWithRetryForTokenRefresh
diff: @@ -231,14 +231,9 @@ export class OdspDocumentService implements IDocumentService {
  * @returns returns the document delta stream service for onedrive/sharepoint driver.
  */
  public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {
  - // Attempt to connect twice, in case we used expired token.
  - return getWithRetryForTokenRefresh<IDocumentDeltaConnection>(async (options) => {
  // Presence of getWebsocketToken callback dictates whether callback is used for fetching
  // websocket token or whether it is returned with joinSession response payload
  const requestWebsocketTokenFromJoinSession = this.getWebsocketToken === undefined;
  - const websocketTokenPromise = requestWebsocketTokenFromJoinSession
  - ? Promise.resolve(null)
  - : this.getWebsocketToken!(options);
  const joinSessionPromise = this.joinSession(requestWebsocketTokenFromJoinSession).catch((e) => {
  const likelyFacetCodes = e as IFacetCodes;
  if (Array.isArray(likelyFacetCodes.facetCodes)) {
  @@ -259,6 +254,12 @@ export class OdspDocumentService implements IDocumentService {
  }
  throw e;
  });
  + // Attempt to connect twice, in case we used expired token.
  + return getWithRetryForTokenRefresh<IDocumentDeltaConnection>(async (options) => {
  + const websocketTokenPromise = requestWebsocketTokenFromJoinSession
  + ? Promise.resolve(null)
  + : this.getWebsocketToken!(options);
  +
  const [websocketEndpoint, websocketToken, io] =
  await Promise.all([
  joinSessionPromise,
  