Communication between multiple web applications using SignalR

I have two different web applications that need to interact with each other (which I can accomplish using Silverlight Duplex, but it does not scale very well). After reading about SignalR, I would like to try, but could not find much documentation on how to do this. Any advice on ho to get started would be greatly appreciated.

Thanks!

More information: Example: Appendix A (Bidding Interface) is a web page that allows multiple end users to place bids for specific items.

Appendix B (control interface) is a web page that allows a user (or potentially several users) to control / control actions from the trading interface.

So, when a user from application A places an application for a piece, I will need to indicate to application B that the bid has been placed. Then from application B, if the user decides to accept the application, I need to send a warning back to application A (update the current price, increase the bid, etc.).

+6
source share
2 answers

Honestly, the easiest way to get each application to push notifications to each other is through standard service calls (WCF endpoints, ASMX, HTTP handlers, MVC controllers, whatever). SignalR is useful when the browser interacts with the server, because there is no consistent way to push from the server to the connected browser. But from a web application to clicking on a web application is simple; Application A simply calls the service endpoint in application B to notify it of what is happening.

+2
source

Assuming you want something like ...

User (browser) --- Appendix A --- Application B --- User (Browser)

Real-time communication can be performed by performing the following actions:

This is not a signal operation, but something like NServiceBus would be consistent with that.

You are referencing a bus dll file, and hubs can both raise and respond to events. In your case, you have both SignalR and Service Bus technology working together to synchronize cross-applications.

So this process is similar to ...

  • The user in app A launches a browser and query page.
  • Appendix A creates a Hub instance that subscribes to Service Bus events on its own.
  • The user in application B launches the browser and query page.
  • Appendix B creates a Hub instance that subscribes to Service Bus events on its own.
  • The user in any application performs some actions, as a result of which SignalR collects the message.
  • SignalR triggers a bus event to say "this user has done something" on the service bus.
  • Another hub on another application, through an event subscription, receives an event notification and takes any action to inform its connected users about it.

The lesson to learn here ... Do not try to make technology to do something beyond its purpose ... use the right tool for the job.

All this decision can be made with just over 20 lines of code after receiving the basic structure.

NServiceBus can be found here:

http://particular.net/nservicebus

Disclaimer: there may be other solutions, but this proposal does not imply that this is the only way to solve this problem, and the only technologies that will be used in this way. I am in no way affiliated with a private product or NServiceBus product.

0
source

Source: https://habr.com/ru/post/899068/


All Articles