Skip to content

Commit

Permalink
chore(tryme): remove usages of the deprecated connect and `disconne…
Browse files Browse the repository at this point in the history
…ct` methods of `SolaceMessageClient`
  • Loading branch information
k-genov committed Feb 4, 2025
1 parent 71e1a29 commit cff1ad2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 27 deletions.
3 changes: 0 additions & 3 deletions apps/solace-message-client-testing-app/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {ApplicationConfig, EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';
import {provideRouter, withHashLocation} from '@angular/router';
import {routes} from './app.routes';
import {provideSolaceMessageClient} from '@solace-community/angular-solace-message-client';
import {SessionConfigStore} from './session-config-store';
import {MAT_FORM_FIELD_DEFAULT_OPTIONS} from '@angular/material/form-field';
import {provideAnimations} from '@angular/platform-browser/animations';

Expand All @@ -13,7 +11,6 @@ export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes, withHashLocation()),
provideAnimations(),
provideSolaceMessageClient(SessionConfigStore.load()),
provideMaterialDefaults(),
],
};
Expand Down
2 changes: 2 additions & 0 deletions apps/solace-message-client-testing-app/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import {LoginComponent} from './login/login.component';
import {TryMeComponent} from './try-me/try-me.component';
import {SessionConfigStore} from './session-config-store';
import {inject} from '@angular/core';
import {provideSolaceMessageClient} from '@solace-community/angular-solace-message-client';

export const routes: Routes = [
{
path: '',
canActivate: [requireLogin],
component: TryMeComponent,
providers: [provideSolaceMessageClient(SessionConfigStore.load())],
},
{
path: 'login',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,11 @@
title="Click to see session properties">
@if (solaceMessageClient.connected$ | async) {
Connected to {{sessionConfig.url}} / {{sessionConfig.vpnName}}
}
@else {
} @else {
Disconnected from the Solace Message Broker
}
</button>

@if (solaceMessageClient.connected$ | async) {
<button mat-stroked-button (click)="onDisconnect()" matTooltip="Disconnect">
<mat-icon>wifi</mat-icon>
</button>
}
@else {
<button mat-stroked-button (click)="onConnect()" matTooltip="Connect">
<mat-icon>wifi_off</mat-icon>
</button>
}

@if (sessionConfig.authenticationScheme === AuthenticationScheme.OAUTH2) {
<button mat-stroked-button (click)="onUpdateAccessToken()">
<mat-icon matTooltip="Provide OAuth 2.0 access token" class="material-icons-outlined">pin</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ export class TryMeComponent {
this._locationService.navigateToAppRoot({clearConnectProperties: true});
}

public onDisconnect(): void {
void this.solaceMessageClient.disconnect();
}

public onConnect(): void {
this.solaceMessageClient.connect(this.sessionConfig).then(
() => console.log('Connected to Solace message broker'),
(error: unknown) => console.error('Failed to connect to Solace message broker', error),
);
}

protected onSessionPropertiesOpen(): void {
this._snackBar.openFromComponent(SessionPropertiesComponent, {
data: this.sessionConfig,
Expand Down

0 comments on commit cff1ad2

Please sign in to comment.