[英]How can i communicate a string from app domain of one project to app domain of another
I have 2 projects - Project A and Project B such that Project A is referenced in Project B. 我有2个项目-项目A和项目B,这样在项目B中引用了项目A。
I want the App domain of A to send a string to the App domain of B by publishing/subscribing event. 我希望A的App域通过发布/订阅事件将字符串发送到B的App域。
I am clueless how to do that ? 我不知道该怎么做? I have referenced this blog [ https://blog.vcillusion.co.in/sending-events-through-application-domain-boundary/ ] but here both the app domains communicate within the same project.
我已经引用了此博客[ https://blog.vcillusion.co.in/sending-events-through-application-domain-boundary/ ],但此处两个应用程序域都在同一项目中进行通信。
Option 1 - I think the best way to do that is to create a Web Service on Project B and consume it on Project A. It can be a simple Rest API with the services you need to execute. 选项1-我认为最好的方法是在Project B上创建一个Web Service并在Project A上使用它。它可以是带有需要执行的服务的简单Rest API。
Option 2 - Sockets . 选项2- 插座 。 You can communicate the two projects with sockets, one acts as server and the other as client.
您可以使用套接字来通信两个项目,一个充当服务器,另一个充当客户端。
Option 3 - WebSockets. 选项3-WebSockets。 It is a bit more complicated than the other two but it provides a good way to make a real-time connection between two projects that don't even have to be hosted in the same server.
它比其他两个项目复杂一些,但是它提供了一种在两个项目之间建立实时连接的好方法,这些项目甚至不必托管在同一服务器上。
You could use ZeroMQ's Request-Reply. 您可以使用ZeroMQ的请求-答复。
server example: http://zguide.zeromq.org/cs:hwserver 服务器示例:http: //zguide.zeromq.org/cs : hwserver
client example: http://zguide.zeromq.org/cs:hwclient 客户示例:http: //zguide.zeromq.org/cs : hwclient
For one server - multiple clients, consider Publish-Subscribe structure. 对于一台服务器-多个客户端,请考虑发布-订阅结构。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.