Skip to content

Commit

Permalink
Fix icc connections not reopened on resolve (#2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel authored Oct 24, 2023
1 parent 1f6e035 commit 749588e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 6 additions & 2 deletions client/src/app/gateways/base-icc-gateway.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export abstract class BaseICCGatewayService<ICCResponseType> {

private connectionClosingFn: (() => void) | undefined;

private get iccEndpointName(): string {
return ICC_ENDPOINT + `_` + this.serviceDescription;
}

/**
* Constructor to create the Service.
* Subclasses can call {@link setupConnections} after the super call to initialize automatic meeting-based connection handling.
Expand Down Expand Up @@ -73,9 +77,9 @@ export abstract class BaseICCGatewayService<ICCResponseType> {
this.disconnect();

const iccMeeting = `${ICC_PATH}${this.receivePath}?meeting_id=${meetingId}`;
this.httpEndpointService.registerEndpoint(ICC_ENDPOINT, iccMeeting, this.healthPath, HttpMethod.GET);
this.httpEndpointService.registerEndpoint(this.iccEndpointName, iccMeeting, this.healthPath, HttpMethod.GET);
const buildStreamFn = () =>
this.httpStreamService.create<ICCResponseType>(ICC_ENDPOINT, {
this.httpStreamService.create<ICCResponseType>(this.iccEndpointName, {
onMessage: (response: ICCResponseType) => this.onMessage(response),
description: this.serviceDescription
});
Expand Down
13 changes: 11 additions & 2 deletions client/src/app/gateways/http-stream/http-stream.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { HttpDownloadProgressEvent, HttpErrorResponse, HttpEvent, HttpHeaderResponse } from '@angular/common/http';
import {
HttpDownloadProgressEvent,
HttpErrorResponse,
HttpEvent,
HttpEventType,
HttpHeaderResponse
} from '@angular/common/http';
import * as fzstd from 'fzstd';
import { firstValueFrom, Observable, Subscription } from 'rxjs';

Expand Down Expand Up @@ -313,8 +319,11 @@ export class HttpStream<T> {
if (this.isClosed) {
console.warn(`Got incoming message from stream ${this.id}, but it is closed.`);
return;
} else if (event.type === HttpEventType.Response) {
this.reconnect();
} else {
this._parser.read(event);
}
this._parser.read(event);
}

private async handleStreamError(error: unknown): Promise<void> {
Expand Down

0 comments on commit 749588e

Please sign in to comment.