Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a self hosted website on my LAN which contains a SignalR hub endpoint.
On receipt of the incoming payload, it is added to a generic list which my Razor _layout.cshtml view renders.
All works well but the data isn't rendered until I reload the page. Is there a way to reload the page from the SignalR hub? or is there another way of achieving this?

What I have tried:

****** Googling and asking here ******
Posted
Updated 18-Aug-23 6:55am
v4

1 solution

You could use SignalR with javascript: signalr javascript example - Google Search[^] - that should point you in the right direction.

UPDATE

An alternative is to use server-side Blazor. Then you can write it all in C#. Under the covers, server-side Blazor uses SignalR. ;)
 
Share this answer
 
v4
Comments
pkfox 18-Aug-23 10:14am    
The SignalR implementation I have is all C# Graeme I don't know javascript - thanks for your reply though
Graeme_Grant 18-Aug-23 11:03am    
JavaScript will work with your implementation. There are samples on how to implement in JavaScript. From what I understand, you're looking for a trigger, so implementation should be simple.
pkfox 18-Aug-23 11:48am    
I'll take a read thanks Graeme
Graeme_Grant 18-Aug-23 11:54am    
All good. Either way, the client needs to handle the refresh.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900