简体   繁体   中英

SignalR notifying both asp.net and web api clients host on separate site

I'm going to build my own system include asp.net web site and web api, they are host on separate site. Architect diagram like image link below.

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

Every time client update something. I need to notify to the others. For example if client 1 upload a photo via web, then client 3 and (mobile app) and client 4(desktop app) should get a notification. My problem is how to tell SignalR send notify to clients in this case. Please advice.

Your diagram must be changed in order to achieve what you need.

In order for this to work all the client types must be SignalR aware. For the web application it's straightforward since the "client" code is the website code itself.

For the mobile and desktop you have an extra layer (webapi) which in this case is an obstacle.

You should define a SignalR hub and connect to it from all the clients: WebApp, MobileApp, DesktopApp.

Knowing this, you can make a WebAPI project containing all the API methods and the SignalR hub(s) and connect to it from the other applications, website included.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM