简体   繁体   中英

ASP.NET Core 6 Angular SignalR template

What is the .NET template for a working ASP.NET Core 6 with SignalR and an Angular ClientApp that has a working WebSockets transport setup?

I can only get the ServerSideEvents transport to work.

dotnet new angular 

doesn't have a working SignalR with websockets...

I can add SignalR, but the websockets don't work

You can configure clientside connection with your requirements. If you want websocket connection you have to configure like this:

  hubConnection =new HubConnectionBuilder()
  .withUrl('your hub url here',HttpTransportType.WebSockets)
  .withAutomaticReconnect()
  .build()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM