Skip to content

Commit

Permalink
dsiable fallback mode for ws streaming mockoon#83
Browse files Browse the repository at this point in the history
  • Loading branch information
isuru89 committed Jan 27, 2024
1 parent 8c4675d commit ea77b33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/commons/src/libs/schema-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export const BuildWebSocketRoute = (

return {
...RouteDefault,
streamingInterval: 100,
type: RouteType.WS,
method: Methods.get,
endpoint: options.endpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<div
*ngIf="activeRoute && activeRoute.type === 'ws'"
class="d-flex mt-2 px-2"
class="d-flex mt-2"
>
<app-toggle
prefix="streaming-modes"
Expand Down Expand Up @@ -123,8 +123,6 @@
</div>
</div>

<hr />

<!-- Route responses navigation tabs -->
<ng-container *ngIf="activeTab$ | async as activeTab">
<div id="route-responses-menu">
Expand Down Expand Up @@ -342,7 +340,11 @@
class="ms-2"
prefix="response-modes"
formControlName="responseMode"
[items]="responseModes"
[items]="
activeRoute.type === 'ws' && activeRoute.streamingMode
? responseModesForWsStreaming
: responseModes
"
appTourStep="tour-route-response-modes"
></app-toggle>
</div>
Expand Down Expand Up @@ -397,7 +399,7 @@
*ngIf="
rulesDisablingResponseModes.includes(
activeRoute.responseMode
)
) || !!activeRoute.streamingMode
"
class="text-warning"
[ngbTooltip]="texts.DISABLED_RULES_WARNING"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ export class EnvironmentRoutesComponent implements OnInit, OnDestroy {
'Fallback response mode (does not return the default response if none of the rules match, will jump to the next route or use the proxy if configured)'
}
];
// disables fallback mode for websockets.
public responseModesForWsStreaming: ToggleItems = this.responseModes.filter(
(m) => m.value !== ResponseMode.FALLBACK
);
public streamingModes: ToggleItems = [
{
value: StreamingMode.UNICAST,
Expand Down

0 comments on commit ea77b33

Please sign in to comment.