Iam using Net Core api and angular, and I have one dashboard here There are some charts. I open this page with two different user. And when I change in database something,from signalr api both changed data and unchanged data are coming like below in console.log. In db I changed 3 to 2 last second element only.
home.component.ts:2153 -1,1,31.01.2020,-1,2,-1
2 home.component.ts:2153 -1,1,31.01.2020,-1,3,-1
2 home.component.ts:2153 -1,1,31.01.2020,-1,2,-1
home.component.ts:2153 -1,1,31.01.2020,-1,3,-1
home.component.ts:2153 -1,1,31.01.2020,-1,2,-1
2 home.component.ts:2153 -1,1,31.01.2020,-1,3,-1
home.component.ts:2153 -1,1,31.01.2020,-1,2,-1
In core part in controller I call this. It call one method and it returns data
[HttpGet]
[Route("Charts")]
public IActionResult Charts(int refShare, int sicil)
{
var timerManager = new TimerManeger(() => _hub.Clients.All.SendAsync(refShare.ToString(), new { type = "chart", data= _repo.SharingDashboard(refShare, sicil) }));
return Ok(new { Message = "Charts Completed" });
}
In angular part
this._hub= new signalR.HubConnectionBuilder().withUrl(Url.url.signalR.getMessages, {
skipNegotiation: true,
transport: signalR.HttpTransportType.WebSockets
}).build();
this._hub.start().
then(()=>console.log("Connection Started")).
catch(err=>console.log(err));
this._hub.on(this.refShare.toString(),(data)=>{
this.RealTimeDahboard(data.data)
});
this.startHttpRequest();
When I write console.log in RealTimeDahboard() function above result comes. So my chart is always changing. It happens when I open with two user at the same time. If I open one user, it works normally.
What can be the reason ?
Thanks for any help