Solace in Angular

boon
boon Member Posts: 3
I would like to integrate the solace client into our application written in angular. I encounter issue when initialized the SolclientFactoryProperties by calling "new solace.SolclientFactoryProperties()" in angular type script.

Please advise it, the error that I encountered is as follow:

1:56:34 PM [vite] Internal server error: Cannot read properties of undefined (reading 'indexOf')
at Object.1124 (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:366297)
at s (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:502858)
at Object.3147 (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:359726)
at s (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:502858)
at Object.3762 (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:115724)
at s (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:502858)
at Object.9691 (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:117428)
at s (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:502858)
at Object.6780 (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:113054)
at s2 (D:\Projects\Entori\ivod_dashboard\node_modules\solclientjs\lib\solclientjs.js:2:502858)

Comments

  • amackenzie
    amackenzie Member, Employee Posts: 268 Solace Employee

    How is solace declared?

  • boon
    boon Member Posts: 3
    import { Injectable } from '@angular/core';
    import solace from 'solclientjs';
    @Injectable({
    providedIn: 'root'
    })
    export class SolaceClientService {

    private factoryPros: any;
    private session:any;

    constructor() {
    this.InitSolaceFactory();
    }

    private InitSolaceFactory():void{
    var factoryPros= new solace.SolclientFactoryProperties();
    //this.factoryPros.profile= solace.SolclientFactoryProfiles.version10;
    //solace.SolclientFactory.init(this.factoryPros);
    }

    public connect(url:string, uid:string, pwd:string, vpn:string ){
    // this.session = solace.SolclientFactory.createSession({
    // url:url,
    // vpnName:vpn,
    // userName:uid,
    // password:pwd
    // });
    // this.session.connect();
    }
    }


    this is the script
  • boon
    boon Member Posts: 3

    And i found that the error happen only in angular (typescript). if i integrate the solace client in react(typescript) . it works fine

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin

    hey @boon ! I would encourage you to check out our community driven github projects found on https://github.com/solacecommunity

    Particularly this project https://github.com/solacecommunity/angular-solace-message-client

    It might give you an idea on how to use solace with angualr.