Skip to content

Commit

Permalink
Fix single au request in fallback mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel committed Apr 10, 2024
1 parent 8fa7b80 commit 5e05300
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion client/src/app/worker/http/http-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export abstract class HttpStream {
private _receivedData: Promise<void>;
private _receivedDataResolver: CallableFunction;

private _queryParams: URLSearchParams;

protected readonly supportLongpolling: boolean = false;
protected connectionMode: 'SSE' | 'LONGPOLLING' = `SSE`;
protected subscription: HttpSubscription;
Expand Down Expand Up @@ -49,6 +51,7 @@ export abstract class HttpStream {
onData: (data: unknown): void => this.handleContent(data),
onError: (data: unknown): void => this.handleError(data)
};
this._queryParams = queryParams;

this.resetReceivedData();
this.updateSubscription();
Expand Down Expand Up @@ -164,7 +167,12 @@ export abstract class HttpStream {
}

private updateSubscription(): void {
if ((<any>self).useLongpolling && this.supportLongpolling && this.connectionMode === `SSE`) {
if (
(<any>self).useLongpolling &&
this.supportLongpolling &&
this.connectionMode === `SSE` &&
(!this._queryParams.has(`single`) || this._queryParams.get(`single`) !== `1`)
) {
this.connectionMode = `LONGPOLLING`;
} else if (this.subscription) {
return;
Expand Down

0 comments on commit 5e05300

Please sign in to comment.