SignalR notifies both asp.net clients and web api clients in a separate site

I am going to create my own system including asp.net website and web api, they are hosted on a separate site. An architectural diagram like the picture below.

http://i.stack.imgur.com/qAlCO.jpg

Every time the client updates something. I need to notify the others. For example, if client 1 uploads a photo over the internet, then client 3 and (mobile app) and client 4 (desktop app) should be notified. My problem is how to tell SignalR to send a notification to clients in this case. Please advice.

+3


source to share


1 answer


Your diagram needs to be modified to achieve what you need.

For this to work, all types of clients must be SignalR-aware. For a web application, this is easy because the "client" code is the site code itself.

For mobile and desktop, you have an additional layer (webapi) which is a hindrance in this case.



You must define a SignalR Hub and connect to it from all clients: WebApp, MobileApp, DesktopApp.

Knowing this, you can create a WebAPI project that contains all the API methods and SignalR Hub and connect to it from other applications including the website.

As far as I know, this is the only way to make this work as you need to include the SignalR library in all your clients code and use it to communicate with the hubs.

+1


source







All Articles