1

After upgrading @aspnet/signalr from 1.0.0 to 1.1.2 , I get the following error when I call startConnection() :

Error parsing handshake response: TypeError: Right-hand side of 'instanceof' is not callable

this is my service :

@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.');
    });
}}

it used to work!

Abolfazl Roshanzamir
  • 12,730
  • 5
  • 63
  • 79
  • 1
    It's better to report this issue here https://github.com/aspnet/AspNetCore with its complete stack-trace. right now it's not clear which part of the app is causing this problem. – VahidN Mar 11 '19 at 15:10

1 Answers1

0

The following code is in my index.html :

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

I removed (commented) Buffer, it solved my problem.

Abolfazl Roshanzamir
  • 12,730
  • 5
  • 63
  • 79