Hereby to master taught this, thank you thank you
presents the code in the
browser console error
now, there are several suspects:
1. I is reference to the signalr here? (download from n have PM to node_modules)
2. Whether the signalr I write right?
3. Why the browser request by more than a '//negotiate? I don't in presents this obviously?
The feeling, really have urgent crazy!
other families and reference code: the server code
CodePudding user response:
Try to jointly study the app. MapSignalRCodePudding user response:
Elder brother I dug grave, I also in studying this problem, your qq I was speechless, with hair, asked me how many 416532793 elder brother see give a newsCodePudding user response:
I have SignaRI PDF, you can referenceCodePudding user response:
https://medium.com/@rukshandangalla/how-to-notify-your-angular-5-app-using-signalr-5e5aea2030b2The import {Component, OnInit} from '@ presents/core;
The import {HubConnection} from '@ aspnet/signalr - client;
The import {Message} from 'primeng/API;
@ Component ({
The selector: 'app - root',
TemplateUrl: './app.com ponent. HTML ',
StyleUrls: ['./app.com ponent. CSS ']
})
Export class AppComponent implements the OnInit {
Private _hubConnection: HubConnection;
MSGS: Message []=[];
The constructor () {}
NgOnInit () : void {
Enclosing _hubConnection=new HubConnection (' http://localhost:1874/notify ');
Enclosing _hubConnection
The start ()
Then (()=& gt; The console. The log (' Connection started! '))
The catch (err=& gt; The console. The log (' Error while establishing the connection: ('));
This. _hubConnection. On (' BroadcastMessage '(type: string, content: string)=& gt; {
Enclosing MSGS. Push ({severity: type, the summary: payload});
});
}
}
CodePudding user response:
Brother have a solutionCodePudding user response:
Has been solved, cross-domain problem