This repository has been archived by the owner on Dec 18, 2018. It is now read-only.
Cannot connect Angular 5 SPA client to ASP.NET Core SignalR Hub #1860
Labels
status: Investigate
Investigation item
I have problem integrating an Angular 5 SPA with an ASP.NET Core SignalR Hub.
ASP.NET Core app info
Hosting: IIS Express 10
Package: Microsoft.AspNetCore.SignalR version 1.0.0-alpha2-final
Relevant code:
Startup.cs
ChatHub.cs
I have a working client based on signalr-client-1.0.0-alpha2-final.js:
The connection is working correctly
Angular 5 application (not working)
package.json
(I have also tried with
@aspnet/signalr@1.0.0-preview1-final
)import { Component, OnInit } from '@angular/core';
import * as signalR from '@aspnet/signalr';
Relevant code:
Connection is not started. Developer Tools (Network) shows a request to
http://localhost:60431/chat/negotiate
which returns a non-JSON response. \Since I have a working client I think I am not using a correct package within Angular 5 app or the transport type is not used at all (thus, the need for negotiate).
How can I overcome this issue?
Please include as much of the following as you can in your bug report
I have problem integrating an Angular 5 SPA with an ASP.NET Core SignalR Hub.
ASP.NET Core app info
Hosting: IIS Express 10
Package: Microsoft.AspNetCore.SignalR version 1.0.0-alpha2-final
Relevant code:
Startup.cs
ChatHub.cs
I have a working client based on signalr-client-1.0.0-alpha2-final.js:
The connection is working correctly
Angular 5 application (not working)
package.json
(I have also tried with
@aspnet/signalr@1.0.0-preview1-final
)import { Component, OnInit } from '@angular/core';
import * as signalR from '@aspnet/signalr';
Relevant code:
Connection is not started. Developer Tools (Network) shows a request to
http://localhost:60431/chat/negotiate
which returns a non-JSON response.Since I have a working client I think I am not using a correct package within Angular 5 app or the transport type is not used at all (thus, the need for negotiate).
How can I overcome this issue?
Thank you.
Please include as much of the following as you can in your bug report
logger
option on yourHubConnection
toLogLevel.Trace
and find the logs in the Console tab of your Browser Dev Toolsnew signalR.HubConnection(url, { logger: signalR.LogLevel.Trace })
Request URL: ws://localhost:4200/sockjs-node/023/12jswgxc/websocket
Request Method: GET
Status Code: 101 Switching Protocols
Request URL: http://localhost:60431/chat/negotiate
Request Method: OPTIONS
Status Code: 204 No Content
Remote Address: [::1]:60431
Referrer Policy: no-referrer-when-downgrade
Request URL: http://localhost:60431/chat/negotiate
Request Method: POST
Status Code: 200 OK
Remote Address: [::1]:60431
Referrer Policy: no-referrer-when-downgrade
(this request returns an invalid JSON response (some default string on invalid route) and the client crushes with Error:
)
Request URL: http://localhost:4200/sockjs-node/info?t=1522913376070
Request Method: GET
Status Code: 200 OK
Remote Address: 127.0.0.1:4200
Referrer Policy: no-referrer-when-downgrade
The text was updated successfully, but these errors were encountered: