Reputation: 5744
I'm very new to Angular, please excute the possibly stupid question.
I'm trying host an asp.net Kestrel server on localhost:5000, which will provide a SignalR service for progress reports. A website I'm creating using Angular 5 is supposed to connect to this (website will either be called via localhost:4200, or just by opening file://.....etc../index.html).
I have installed the package @aspnet/signalr-client via NPM. I have done no other manual modifications to my project (no polyfills or whatever else there may be).
Then I edited my main component's .TS to include
import { HubConnection } from '@aspnet/signalr-client';
which still works fine so far. But then I added a private variable
private _hubConnection: HubConnection;
and in the ngOnInit() function, I'm calling
this._hubConnection = new HubConnection('/progress');
and now, accessing the website will throw an error in Internet Explorer 11, namely an Error: Syntax Error. If I'm reading the debugger right, it seems to be in signalr-client/dist/src/HttpContext.js in some code like
eval("\n// Copyright (c) .NET Foundation. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) {
... etc ...
I'm quite clueless what could cause this. Do I need to make any other manual modifications to my project, include any other files or such? Could it be that it can't connect to my SignalR progress server and hence throws this odd error or somethign?
Thanks
Upvotes: 0
Views: 650
Reputation: 5744
Ah, seems like this is an incompatibility of the standard package with IE11, see
https://github.com/aspnet/SignalR/issues/777
I'll try to circumvent this via
import { HubConnection } from '@aspnet/signalr-client/dist/browser/signalr-clientES5-1.0.0-alpha2-final.js';
Upvotes: 1
Reputation: 1703
You host your app and your signalR on two differents apps, so you have to specify the absolute URL of your signalR app.
this._hubConnection = new HubConnection('http://localhost:5000/signalr/progress');
Port number of your web app is different than your signalR app, don't forget to allow CORS because you will get Cross-domain error with Chrome and Firefox.
Upvotes: 1