[英]Sending signals from a remote server to a .NET application
I have a .NET application which sends PHP GET and POST requests to my server (on an AWS EC-2 instance). 我有一个.NET应用程序,它将PHP GET和POST请求发送到我的服务器(在AWS EC-2实例上)。
I now have a need for the local application to know in real-time when an event on the server happens. 现在,我需要本地应用程序实时知道服务器上的事件何时发生。 Basically two "accounts" are linked and they need to synchronize, so when one makes a change on the server, then the server must send a signal to the other to update it's "view".
基本上两个“帐户”是链接的,它们需要同步,因此当一个在服务器上进行更改时,服务器必须向另一个发送信号以更新其“视图”。
I'm aware that I could achieve this by constantly querying to server to check for changes, but that seems horrendous. 我知道我可以通过不断查询服务器以检查更改来实现此目的,但这似乎太可怕了。
Could someone please point in the right direction here? 有人可以在这里指出正确的方向吗?
Thanks! 谢谢!
Certainly you could use signalR, signalR can be hosted like website, when your client starts it can connect to this signalR website. 当然,您可以使用signalR,signalR可以像网站一样托管,当您的客户端启动时,可以连接到该signalR网站。 SiganlR should be hosted separately from your server application.
SiganlR应该与服务器应用程序分开托管。
Let say A,B client and your Server application got connected to signalR. 假设A,B客户端和您的Server应用程序已连接到signalR。 Now when A modifies something using post method to your PHP server, PHP server then can invoke a method in signalR , then signalR can broadcast message to all the clients connected.
现在,当A使用post方法对您的PHP服务器进行修改时,PHP服务器可以在signalR中调用一个方法,然后signalR可以向所有连接的客户端广播消息。 You can use group concept in signalR to target specific audience.
您可以在signalR中使用组概念来定位特定的受众。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.