Angular '的右侧;instanceof';在信号器1.1.2中不可调用

Angular '的右侧;instanceof';在信号器1.1.2中不可调用,angular,signalr-client,Angular,Signalr Client,将@aspnet/signal从1.0.0升级到1.1.2 ,调用startConnection()时出现以下错误: 分析握手响应时出错:TypeError:“instanceof”的右侧不可调用 这是我的服务: @Injectable() export class SignalRService { careworkerTrckInfo = new EventEmitter<GeoLocationCareWorkerTrackSignalR>(); connectionEs

将@aspnet/signal从1.0.0升级到1.1.2 ,调用startConnection()时出现以下错误:

分析握手响应时出错:TypeError:“instanceof”的右侧不可调用

这是我的服务:

@Injectable()
export class SignalRService {

  careworkerTrckInfo = new EventEmitter<GeoLocationCareWorkerTrackSignalR>();
  connectionEstablished = new EventEmitter<Boolean>();

  private connectionIsEstablished = false;
  private serverTimeoutInMilliseconds = 50000; // 50 Second

  private _hubConnection: HubConnection;

constructor(
    @Inject(APP_CONFIG) private appConfig: IAppConfig) {
    this.createConnection();
    this.startConnection();
}

private createConnection() {
    const url = `${this.appConfig.apiEndpoint}/notifications`;
    this._hubConnection = new HubConnectionBuilder()
        .withUrl(url)
        .build();
    this._hubConnection.serverTimeoutInMilliseconds = this.serverTimeoutInMilliseconds;
}

private startConnection() {
    this._hubConnection
    .start()
    .then(() => {
        this.connectionIsEstablished = true;
        this.connectionEstablished.emit(true);
    })
    .catch(err => {
        console.log('Error while establishing connection.');
    });
}}
@Injectable()
导出类信号服务{
careworkertckinfo=neweventemitter();
connectionEstablished=新的EventEmitter();
私有连接已建立=false;
private ServerTimeOutingMissels=50000;//50秒
专用hubConnection:hubConnection;
建造师(
@注入(APP_CONFIG)私有appConfig:IAppConfig){
这个.createConnection();
this.startConnection();
}
私有createConnection(){
常量url=`${this.appConfig.apidendpoint}/notifications`;
这是。_hubConnection=new HubConnectionBuilder()
.withUrl(url)
.build();
this.\u hubConnection.servertimeoutinmillizes=this.servertimeoutinmillizes;
}
专用startConnection(){
这是一个连接
.start()
.然后(()=>{
this.connectionisestabled=true;
此.connectionEstablished.emit(true);
})
.catch(错误=>{
log('建立连接时出错');
});
}}

它曾经有用

以下代码在my index.html中:

<script>
    var global = global || window;
    // var Buffer = Buffer || []; --> remove or comment this line
    var process = process || {
        env: {
            DEBUG: undefined
        },
        version: []
    };
</script>

var global=全局| |窗口;
//var Buffer=Buffer | |[];-->删除或注释此行
var过程=过程| |{
环境:{
调试:未定义
},
版本:[]
};

我删除了(注释)缓冲区,它解决了我的问题。

以下代码在我的index.html中:

<script>
    var global = global || window;
    // var Buffer = Buffer || []; --> remove or comment this line
    var process = process || {
        env: {
            DEBUG: undefined
        },
        version: []
    };
</script>

var global=全局| |窗口;
//var Buffer=Buffer | |[];-->删除或注释此行
var过程=过程| |{
环境:{
调试:未定义
},
版本:[]
};

我删除了(注释)缓冲区,它解决了我的问题。

最好在这里报告此问题及其完整的堆栈跟踪。目前尚不清楚应用程序的哪个部分导致了此问题。最好在这里报告此问题及其完整的堆栈跟踪。目前还不清楚应用程序的哪个部分导致了这个问题。