I have signalr server running. That keeps sending updated information.
I have following code in index.html within tag
$.connection.hub.url = "http://localhost:8080/signalr";
// Declare a proxy to reference the hub.
var chat = $.connection.myHub;
// Create a function that the hub can call to broadcast messages.
chat.client.addMessage = function (name, message) {
// Html encode display name and message.
console.log ("chat.client.addMessage.index");
};
And same is added in component ts file
ngOnInit () {
jQuery.connection.hub.url = "http://localhost:8080/signalr";
// Declare a proxy to reference the hub.
var chat = jQuery.connection.myHub;
// Create a function that the hub can call to broadcast messages.
chat.client.addMessage = function (name, message) {
// Html encode display name and message.
console.log ("chat.client.addMessage.index"); ""
};
}
The addMessage is called from SignalR Hub server. And is received by addMessage registered in index.html but not by function registered in component ts.
On debug, I could find that function has got registered in both places. I tried registering different functions and server calling both functions. But in either cases the function registered in component/ type script is not called.
any help will be thankful